2013-06-14 15:48:13 +00:00
|
|
|
#ifndef _TEXTCOMPONENT_H_
|
|
|
|
#define _TEXTCOMPONENT_H_
|
|
|
|
|
|
|
|
#include "../GuiComponent.h"
|
|
|
|
#include "../Font.h"
|
|
|
|
|
|
|
|
class TextComponent : public GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TextComponent(Window* window);
|
|
|
|
TextComponent(Window* window, const std::string& text, Font* font, Vector2i pos, Vector2u size);
|
|
|
|
|
|
|
|
void setFont(Font* font);
|
|
|
|
void setBox(Vector2i pos, Vector2u size);
|
2013-06-19 01:12:30 +00:00
|
|
|
void setExtent(Vector2u size); //Use Vector2u(0, 0) to automatically generate extent.
|
2013-06-14 15:48:13 +00:00
|
|
|
void setText(const std::string& text);
|
|
|
|
void setColor(unsigned int color);
|
|
|
|
|
|
|
|
void onRender();
|
|
|
|
|
|
|
|
private:
|
2013-06-19 01:12:30 +00:00
|
|
|
void calculateExtent();
|
|
|
|
|
2013-06-14 15:48:13 +00:00
|
|
|
unsigned int mColor;
|
|
|
|
Font* mFont;
|
2013-06-19 01:12:30 +00:00
|
|
|
bool mAutoCalcExtent;
|
2013-06-14 15:48:13 +00:00
|
|
|
std::string mText;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|