Skip to content

Commit

Permalink
Ain't nobody got time for using the wrong prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruskiy69 committed Jul 15, 2013
1 parent e506645 commit 17eec12
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
8 changes: 3 additions & 5 deletions include/Zenderer/GUI/Font.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ namespace gui
* @post `Ent` contains a renderable string using this font.
*
* @warning Any existing data in the entity is deleted.
*
* @todo Store line height properly.
**/
bool Render(obj::CEntity& Ent, const string_t text = "");

Expand All @@ -142,9 +140,9 @@ namespace gui
* Please reference the font loading example to see proper
* techniques for using the font API.
*
* @pre The given manager must be initialized.
*
* @param Assets The asset manager to attach.
*
* @pre The given manager must be initialized.
**/
void AttachManager(asset::CAssetManager& Assets);

Expand All @@ -165,7 +163,7 @@ namespace gui
color4f_t m_Color;
FT_Face m_FontFace;

std::map<char, glyph_t> mp_glyphData;
std::map<char, glyph_t> m_glyphData;
std::stringstream m_str;

uint16_t m_size;
Expand Down
16 changes: 8 additions & 8 deletions src/GUI/Font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ bool CFont::LoadFromFile(const string_t& filename)

const void* const CFont::GetData() const
{
return reinterpret_cast<const void* const>(&mp_glyphData);
return reinterpret_cast<const void* const>(&m_glyphData);
}

bool CFont::Render(obj::CEntity& Ent, const string_t to_render)
Expand Down Expand Up @@ -127,7 +127,7 @@ bool CFont::Render(obj::CEntity& Ent, const string_t to_render)
char letter = (c > '~' || c < ' ') ? ' ' : c;

// Shortcut to glyph data.
const glyph_t& gl = mp_glyphData[letter];
const glyph_t& gl = m_glyphData[letter];

real_t x = gl.position.x; // Store current x-coordinate.
real_t h = gl.position.y; // Store current y-coordinate.
Expand Down Expand Up @@ -209,7 +209,7 @@ bool CFont::Render(obj::CEntity& Ent, const string_t to_render)
// Render each character (skip if unrenderable).
if(text[i] > '~' || text[i] < ' ') continue;

mp_glyphData[text[i]].texture->Bind();
m_glyphData[text[i]].texture->Bind();
GL(glDrawElements(GL_TRIANGLES, 6, gfxcore::INDEX_TYPE,
(void*)(sizeof(gfxcore::index_t) * i * 6)));
}
Expand Down Expand Up @@ -278,9 +278,9 @@ void CFont::ClearString()
bool CFont::Destroy()
{
m_size = 18;
for(auto i : mp_glyphData)
for(auto i : m_glyphData)
mp_Assets->Delete(i.second.texture);
mp_glyphData.clear();
m_glyphData.clear();
this->ClearString();
return true;
}
Expand Down Expand Up @@ -335,7 +335,7 @@ bool CFont::LoadGlyph(const char c, const uint16_t index)
glyph.position = math::vector_t(slot->metrics.horiBearingY >> 6,
slot->metrics.horiBearingX >> 6);
glyph.advance = slot->advance.x >> 6;
mp_glyphData[c] = glyph;
m_glyphData[c] = glyph;
return true;
}

Expand Down Expand Up @@ -365,8 +365,8 @@ uint16_t CFont::GetTextWidth(const string_t& text) const
}
else
{
const auto it = mp_glyphData.find(text[i]);
if(it != mp_glyphData.end())
const auto it = m_glyphData.find(text[i]);
if(it != m_glyphData.end())
{
tmp_w += math::max<uint16_t>(it->second.size.w,
it->second.advance);
Expand Down

0 comments on commit 17eec12

Please sign in to comment.