summaryrefslogtreecommitdiff
path: root/src/interface/Label.cpp
blob: c77b6bf04a0d3686f5872ef02534c44632ef91cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <string>
#include "Config.h"
#include "Global.h"
#include "interface/Point.h"
#include "interface/Label.h"

using namespace ui;

Label::Label(State* parent_state, std::string labelText):
	Component(parent_state),
	LabelText(labelText)
{

}

Label::Label(Point position, Point size, std::string labelText):
	Component(position, size),
	LabelText(labelText)
{

}

Label::Label(std::string labelText):
	Component(),
	LabelText(labelText)
{

}

Label::~Label()
{

}


void Label::Draw(const Point& screenPos)
{
	Graphics * g = Global::Ref().g;
	g->drawtext(Position.X+(Size.X-Graphics::textwidth((char *)LabelText.c_str()))/2, Position.Y+(Size.Y-10)/2, LabelText, 255, 255, 255, 255);
}