replace kFont with std::string
This commit is contained in:
16
src/font.h
16
src/font.h
@@ -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();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user