bettola/client/src/gfx/txt_renderer.h
Ritchie Cunningham cf48324516 [Refactor] Givin' the client some luv!
Refactored client-side rendering code to use a Color struct rather than
raw float arrays.
2025-09-27 22:58:04 +01:00

32 lines
665 B
C++

#pragma once
#include <ft2build.h>
#include FT_FREETYPE_H
#include <map>
#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<char, character> _chars;
float _projecton[16];
};