Fix text rendering

This commit is contained in:
Corentin 2021-07-13 00:35:45 +09:00
commit 1a200205a5
12 changed files with 214 additions and 68 deletions

View file

@ -64,7 +64,8 @@ protected:
int width;
int height;
bool need_resize_refresh;
bool render_needed;
bool resize_needed;
bool iconified;
@ -79,7 +80,7 @@ protected:
void init();
void deinit();
void draw();
void render();
static void glfw_resize_callback(GLFWwindow* window, int width, int height);
static void glfw_iconify_callback(GLFWwindow* window, int iconified);

View file

@ -35,7 +35,7 @@ public:
struct Font
{
character_info char_infos[256];
GLuint tex;
GLuint atlas_texture;
unsigned int atlas_width;
unsigned int atlas_height;
};
@ -51,7 +51,7 @@ public:
std::tuple<int, int> get_text_size(const std::string& text, Font& font, float scale_x, float scale_y);
private:
static constexpr int MAX_WIDTH = 1024;
static constexpr int ATLAS_MAX_WIDTH = 1024;
bool initialized;

View file

@ -18,7 +18,7 @@ class GlLabel: public GlComponent
protected:
std::string text;
const std::tuple<float, float, float, float>& text_color;
std::tuple<float, float, float, float> text_color;
int text_width;
int text_height;