add support for Apple Pencil and build for iOS
This commit is contained in:
@@ -16,7 +16,7 @@ bool Font::load(const char* ttf, int font_size)
|
||||
LOG("Font::load loaded");
|
||||
auto bitmap = std::make_unique<uint8_t[]>(w*h);
|
||||
chars.resize(num_chars);
|
||||
stbtt_BakeFontBitmap(file.m_data, 0, (float)font_size, bitmap.get(), w, h, start_char, num_chars, chars.data());
|
||||
stbtt_BakeFontBitmap(file.m_data, 0, (float)font_size*2, bitmap.get(), w, h, start_char, num_chars, chars.data());
|
||||
font_tex.create(w, h, GL_R8, GL_RED, bitmap.get());
|
||||
file.close();
|
||||
return true;
|
||||
@@ -75,18 +75,18 @@ void TextMesh::update(kFont id, const char* text)
|
||||
stbtt_aligned_quad q;
|
||||
stbtt_GetBakedQuad((stbtt_bakedchar*)f.chars.data(), f.w, f.h, c, &x, &y, &q, true);
|
||||
auto n = (int)v.size();
|
||||
v.emplace_back(q.x0, q.y1, q.s0, q.t1);
|
||||
v.emplace_back(q.x0, q.y0, q.s0, q.t0);
|
||||
v.emplace_back(q.x1, q.y0, q.s1, q.t0);
|
||||
v.emplace_back(q.x1, q.y1, q.s1, q.t1);
|
||||
v.emplace_back(q.x0/2.f, q.y1/2.f, q.s0, q.t1);
|
||||
v.emplace_back(q.x0/2.f, q.y0/2.f, q.s0, q.t0);
|
||||
v.emplace_back(q.x1/2.f, q.y0/2.f, q.s1, q.t0);
|
||||
v.emplace_back(q.x1/2.f, q.y1/2.f, q.s1, q.t1);
|
||||
idx.push_back(n+0);
|
||||
idx.push_back(n+1);
|
||||
idx.push_back(n+2);
|
||||
idx.push_back(n+0);
|
||||
idx.push_back(n+2);
|
||||
idx.push_back(n+3);
|
||||
bbmin = glm::min(bbmin, { q.x0, q.y0 });
|
||||
bbmax = glm::max(bbmax, { q.x1, q.y1 });
|
||||
bbmin = glm::min(bbmin, { q.x0/2.f, q.y0/2.f });
|
||||
bbmax = glm::max(bbmax, { q.x1/2.f, q.y1/2.f });
|
||||
}
|
||||
for (int i = 0; i < len*4; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user