added node alignment and text color
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
std::map<kFont, Font> FontManager::m_fonts;
|
||||
Sampler FontManager::m_sampler;
|
||||
|
||||
bool Font::load(const char* ttf)
|
||||
bool Font::load(const char* ttf, int font_size)
|
||||
{
|
||||
FILE* font_file = fopen(ttf, "rb");
|
||||
if (font_file)
|
||||
@@ -18,7 +18,7 @@ bool Font::load(const char* ttf)
|
||||
assert(bytes==sz);
|
||||
auto bitmap = std::make_unique<uint8_t[]>(w*h);
|
||||
chars.resize(num_chars);
|
||||
int ret = stbtt_BakeFontBitmap(data.get(), 0, 50, bitmap.get(), w, h, start_char, num_chars, chars.data());
|
||||
int ret = stbtt_BakeFontBitmap(data.get(), 0, (float)font_size, bitmap.get(), w, h, start_char, num_chars, chars.data());
|
||||
font_tex.create(w, h, GL_RED, bitmap.get());
|
||||
fclose(font_file);
|
||||
return true;
|
||||
@@ -31,9 +31,9 @@ void FontManager::init()
|
||||
m_sampler.create();
|
||||
}
|
||||
|
||||
bool FontManager::load(kFont id, const char *ttf)
|
||||
bool FontManager::load(kFont id, const char* ttf, int sz)
|
||||
{
|
||||
return m_fonts[id].load(ttf);
|
||||
return m_fonts[id].load(ttf, sz);
|
||||
}
|
||||
|
||||
const Font& FontManager::get(kFont id)
|
||||
|
||||
Reference in New Issue
Block a user