aboutsummaryrefslogtreecommitdiffstats
path: root/src/text.cpp
diff options
context:
space:
mode:
authorAndy Belle-Isle <drumsetmonkey@gmail.com>2019-10-08 03:03:16 -0400
committerAndy Belle-Isle <drumsetmonkey@gmail.com>2019-10-08 03:03:16 -0400
commita422f32613441b5313e4a3bb0fab61f8cb87914c (patch)
tree0a6c8f17e6a8df0b6c377813fa700064f68ced93 /src/text.cpp
parent5f53889d4357d8dba6e726ed38358eca96dbeb47 (diff)
parent5b1c22529a946a782a8376de2b34c28348d078d1 (diff)
Using polymorphism for world layer storage now, and added demo backdrops
Diffstat (limited to 'src/text.cpp')
-rw-r--r--src/text.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/text.cpp b/src/text.cpp
index 6917a2c..fb82875 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -4,6 +4,14 @@
#include <iostream>
+TextSystem::~TextSystem(void)
+{
+ for (auto [name, face] : fonts)
+ FT_Done_Face(face);
+
+ FT_Done_FreeType(freetype);
+}
+
void TextSystem::configure([[maybe_unused]] entityx::EntityManager& entities,
[[maybe_unused]] entityx::EventManager& events)
{
@@ -25,12 +33,11 @@ void TextSystem::update([[maybe_unused]] entityx::EntityManager& entites,
shouldUpdateVBOs = false;
updateVBOs();
- for (auto& data : fontData) {
- auto& d = data.second;
- if (d.text.size() == 0)
- continue;
-
- events.emit<NewRenderEvent>(d.vbo, d.tex, 0, d.buffer.size());
+ for (auto& [name, font] : fontData) {
+ if (font.text.size() != 0) {
+ events.emit<NewRenderEvent>(font.vbo, font.tex, 0,
+ font.buffer.size());
+ }
}
}
}
@@ -145,8 +152,7 @@ void TextSystem::put(const std::string& font,
void TextSystem::updateVBOs(void)
{
- for (auto& data : fontData) {
- auto& d = data.second;
+ for (auto& [name, d] : fontData) {
d.buffer.clear();
for (auto& text : d.text) {
float tx = text.x;