#pragma once #include #include FT_FREETYPE_H #include #include "shader.h" #include "types.h" /* State of a single charactrer glyph. */ struct character { unsigned int texture_id; int size[2]; int bearing[2]; unsigned int advance; }; class TextRenderer { public: TextRenderer(unsigned int screen_width, unsigned int screen_height); ~TextRenderer(void); void load_font(const char* font_path, unsigned int font_size); void render_text(const char* text, float x, float y, float scale, const Color& color); private: Shader* _txt_shader; unsigned int _vao, _vbo; std::map _chars; float _projecton[16]; };