more flexible skins

This commit is contained in:
Eduardo Bart
2011-04-11 17:06:03 -03:00
parent da2993d1f9
commit c3f0ca2b4f
24 changed files with 224 additions and 102 deletions

View File

@@ -24,25 +24,12 @@
#include "uilabel.h"
#include "graphics/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));
}
#include "uilabelskin.h"
void UILabel::setText(const std::string& text)
{
setSize(m_font->calculateTextRectSize(text));
UILabelSkin *skin = static_cast<UILabelSkin*>(getSkin());
setSize(skin->getFont()->calculateTextRectSize(text));
m_text = text;
}