37 lines
786 B
C++
37 lines
786 B
C++
#pragma once
|
|
|
|
#include <ft2build.h>
|
|
#include <glm/glm.hpp>
|
|
#include <map>
|
|
#include FT_FREETYPE_H
|
|
|
|
#include "Gedeng/Shader.h"
|
|
#include "Gedeng/String.h"
|
|
#include "Gedeng/Vector3.h"
|
|
|
|
namespace Gedeng {
|
|
|
|
class TextLabel {
|
|
public:
|
|
TextLabel();
|
|
|
|
void render_text(String 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<char, Character> characters;
|
|
unsigned int vao, vbo;
|
|
bool valid;
|
|
|
|
Shader shader;
|
|
};
|
|
|
|
} // namespace Gedeng
|