end
end
end
- self:setData(1000, 1345, 5, "grass"); -- Test error checking
+ --self:setData(1000, 1345, 5, "grass"); -- Test error checking
print("Done with world gen");
end
}
context = SDL_GL_CreateContext(window.get());
- GLenum err;
glewExperimental = GL_TRUE;
- if((err=glewInit()) != GLEW_OK){
+ if (auto err = glewInit(); err != GLEW_OK){
std::cerr << "GLEW was not able to initialize! Error: " <<
glewGetErrorString(err) << std::endl;
return -1;
#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)
{
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());
+ }
}
}
}
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;