#pragma once #include #include #include #include FT_FREETYPE_H #include "Gedeng/Shader.h" #include "Gedeng/String.h" #include "Gedeng/Vector3.h" namespace Gedeng { class TextLabel { public: TextLabel(const String &text = String("")); void set_text(const String &text); void render_text(float x, float y, float scale, Vector3 color); bool is_valid(); private: struct Character { unsigned int texture_id; // ID handle of the glyph texture glm::ivec2 size; // Size of glyph glm::ivec2 bearing; // Offset from baseline to left/top of glyph unsigned int advance; // Offset to advance to next glyph }; std::map characters; unsigned int vao, vbo; String text; bool valid; Shader shader; }; } // namespace Gedeng