basic menu functionallity

This commit is contained in:
Eduardo Bart
2011-04-09 21:51:35 -03:00
parent f2bdc89d8d
commit 9d1ddf34bf
16 changed files with 313 additions and 22 deletions

View File

@@ -23,4 +23,26 @@
#include "uilabel.h"
#include "../fonts.h"
UILabel::UILabel(const std::string& text, Font* font) :
UIElement(UI::Label),
m_text(text),
m_font(font)
{
if(!font)
m_font = g_fonts.get("tibia-10px-antialised");
setSize(m_font->calculateTextRectSize(text));
}
void UILabel::render()
{
m_font->renderText(m_text, getRect(), ALIGN_LEFT, Color(0xFFBFBFBF));
}
void UILabel::setText(const std::string& text)
{
setSize(m_font->calculateTextRectSize(text));
m_text = text;
}