Skip to content

Commit

Permalink
#2: Setting to prevent content deletion for text.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruskiy69 committed Jul 25, 2013
1 parent 079a07e commit 637c626
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions include/Zenderer/GUI/Font.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ namespace gui
/// Sets the font size.
void SetSize(const uint16_t size) { m_size = size; }

/// Enables / Disables rendering on top of existing entity data.
void SetStacking(const bool flag);

uint16_t GetTextWidth(const string_t& text) const;
uint16_t GetTextHeight(const string_t& text) const;

Expand All @@ -187,6 +190,7 @@ namespace gui

uint16_t m_size;
uint16_t m_height;
bool m_stack;
};
} // namespace gfx
} // namespace zen
Expand Down
9 changes: 7 additions & 2 deletions src/GUI/Font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ gfx::CEffect* CFont::s_FontFx = nullptr;
CFont::CFont(const void* const owner) :
CAsset(owner), mp_Assets(nullptr),
m_Color(0.0, 0.0, 0.0, 1.0),
m_size(18), m_height(0)
m_size(18), m_height(0), m_stack(false)
{}

CFont::~CFont()
Expand Down Expand Up @@ -108,7 +108,7 @@ bool CFont::Render(obj::CEntity& Ent, const string_t to_render)
<< "Rendering text string '" << text << "'." << CLog::endl;

// Fresh start.
Ent.Destroy();
if(!m_stack) Ent.Destroy();

// 4 vertices for each character, and 6 indices for
// each character.
Expand Down Expand Up @@ -411,6 +411,11 @@ void CFont::SetColor(const color4f_t& Color)
m_Color = Color;
}

void CFont::SetStacking(const bool flag)
{
m_stack = flag;
}

uint16_t CFont::GetTextWidth(const string_t& text) const
{
if(text.empty()) return 0;
Expand Down

0 comments on commit 637c626

Please sign in to comment.