This commit is contained in:
Kbz-8
2024-10-28 20:17:39 +01:00
parent 77240013a4
commit 3153941573
9 changed files with 73 additions and 73 deletions

View File

@@ -50,17 +50,17 @@ namespace mlx
}
#ifdef DEBUG
m_atlas.Init(vulkan_bitmap, RANGE, RANGE, VK_FORMAT_R8G8B8A8_SRGB, false, m_name + "_font_atlas");
m_atlas.Init(vulkan_bitmap, RANGE, RANGE, VK_FORMAT_R8G8B8A8_SRGB, false, m_name + "_font_atlas_" + std::to_string(m_scale));
#else
m_atlas.Init(vulkan_bitmap, RANGE, RANGE, VK_FORMAT_R8G8B8A8_SRGB, false, {});
#endif
DebugLog("Font: loaded %", m_name);
DebugLog("Font: loaded % with a scale of %", m_name, m_scale);
}
void Font::Destroy()
{
m_atlas.Destroy();
DebugLog("Font: unloaded %", m_name);
DebugLog("Font: unloaded % with a scale of %", m_name, m_scale);
}
}

View File

@@ -19,13 +19,14 @@ namespace mlx
float stb_x = 0.0f;
float stb_y = 0.0f;
auto char_data = font->GetCharData();
for(char c : text)
{
if(c < 32)
continue;
stbtt_aligned_quad q;
stbtt_GetPackedQuad(font->GetCharData().data(), RANGE, RANGE, c - 32, &stb_x, &stb_y, &q, 1);
stbtt_GetPackedQuad(char_data.data(), RANGE, RANGE, c - 32, &stb_x, &stb_y, &q, 1);
std::size_t index = vertex_data.size();