TimerOverlay/inc/character_utils.h

32 lines
747 B
C
Raw Permalink Normal View History

2024-06-12 23:48:27 +00:00
#include <GL/glew.h>
#include <glm/glm.hpp>
#include <unordered_map>
#include <ft2build.h>
#include FT_FREETYPE_H
struct Character {
unsigned int TextureID; // ID handle of the glyph texture
glm::ivec2 Size; // Size of glyph
glm::ivec2 Bearing; // Offset from baseline to left/top of glyph
FT_Pos Advance; // Offset to advance to next glyph
};
class Font
{
public:
Font() = delete;
2024-06-19 05:42:42 +00:00
Font(const char* font, FT_UInt size);
2024-06-12 23:48:27 +00:00
void RenderText(GLuint VAO, GLuint VBO, GLuint shaderProgram, const char* text, float x, float y, float scale);
private:
2024-06-19 05:42:42 +00:00
void SetupCharMap(FT_Face& face, FT_UInt size);
2024-06-12 23:48:27 +00:00
public:
bool LoadError;
private:
std::unordered_map<GLchar, Character> m_Characters;
};