image class

This commit is contained in:
Eduardo Bart
2011-04-08 15:29:59 -03:00
parent 77b31e425a
commit f54ef6401d
13 changed files with 200 additions and 54 deletions

View File

@@ -27,23 +27,24 @@
#include "../font.h"
UIButton::UIButton(const std::string& text) :
m_text(text)
m_text(text),
m_state(UI::ButtonUp)
{
m_boderedImage = BorderedImagePtr(new BorderedImage("ui.png"));
m_boderedImage->setTexCoords(Rect(45,139,1,18),
Rect(130,139,1,18),
Rect(46,138,84,1),
Rect(46,157,84,1),
Rect(45,138,1,1),
Rect(130,138,1,1),
Rect(45,157,1,1),
Rect(130,157,1,1),
Rect(46,139,84,18));
m_imageButtonUp = ImagePtr(new BorderedImage("ui.png",
Rect(45,139,1,18),
Rect(130,139,1,18),
Rect(46,138,84,1),
Rect(46,157,84,1),
Rect(45,138,1,1),
Rect(130,138,1,1),
Rect(45,157,1,1),
Rect(130,157,1,1),
Rect(46,139,84,18)));
}
void UIButton::render()
{
m_boderedImage->draw(m_rect);
m_imageButtonUp->draw(m_rect);
g_fonts.get("tibia-8px-antialised")->renderText(m_text, m_rect, ALIGN_CENTER);
}