MCPcopy Create free account
hub / github.com/defold/defold / CreateGlyphBank

Function CreateGlyphBank

engine/render/src/test/test_render.cpp:68–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68static dmRenderDDF::GlyphBank* CreateGlyphBank(uint32_t max_ascent, uint32_t max_descent, uint32_t glyph_count)
69{
70 dmRenderDDF::GlyphBank* bank = new dmRenderDDF::GlyphBank;
71 memset(bank, 0, sizeof(*bank));
72
73 bank->m_Glyphs.m_Count = glyph_count;
74 bank->m_Glyphs.m_Data = new dmRenderDDF::GlyphBank::Glyph[glyph_count];
75
76 memset(bank->m_Glyphs.m_Data, 0, sizeof(dmRenderDDF::GlyphBank::Glyph) * glyph_count);
77 for (uint32_t i = 0; i < glyph_count; ++i)
78 {
79 bank->m_Glyphs[i].m_Character = i;
80 bank->m_Glyphs[i].m_Width = 1;
81 bank->m_Glyphs[i].m_LeftBearing = 1;
82 bank->m_Glyphs[i].m_Advance = 2;
83 bank->m_Glyphs[i].m_Ascent = 2;
84 bank->m_Glyphs[i].m_Descent = 1;
85 }
86
87 bank->m_MaxAscent = max_ascent;
88 bank->m_MaxDescent = max_descent;
89
90 return bank;
91}
92
93static void DestroyGlyphBank(dmRenderDDF::GlyphBank* bank)
94{

Callers 1

SetUpMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected