replace kFont with std::string

This commit is contained in:
2019-12-01 15:00:10 +01:00
parent 0ee3f1d125
commit 0905827b8d
11 changed files with 38 additions and 46 deletions

View File

@@ -3,12 +3,6 @@
#include "util.h"
#include <stb/stb_truetype.h>
enum class kFont : uint16_t
{
Arial_11 = const_hash("arial-11"),
Arial_30 = const_hash("arial-30"),
};
class Font
{
public:
@@ -33,11 +27,11 @@ public:
class FontManager
{
public:
static std::map<kFont, Font> m_fonts;
static std::map<std::string, Font> m_fonts;
static Sampler m_sampler;
static void init();
static bool load(kFont id, const char* ttf, int sz, float scale);
static const Font& get(kFont id);
static bool load(const std::string& id, const char* ttf, int sz, float scale);
static const Font& get(const std::string& id);
static void invalidate() { m_fonts.clear(); }
static void change_scale(float scale);
};
@@ -56,10 +50,10 @@ public:
int font_array_count = 0;
int max_width = 0;
GLuint font_buffers[2] = {0, 0};
kFont font_id;
std::string font_id;
glm::vec2 bb = { 0, 0 };
glm::vec4 cur_box;
bool create();
void update(kFont id, const std::string& text);
void update(const std::string& id, const std::string& text);
void draw();
};