-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlabel-widget.hh
58 lines (45 loc) · 1.07 KB
/
label-widget.hh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef _GRAVITY_LABEL_WIDGET_HH_
#define _GRAVITY_LABEL_WIDGET_HH_
#include "widget.hh"
#include <SDL2/SDL.h>
#include <string>
using namespace std;
class LabelWidget : public Widget {
protected:
string text;
float x;
float y;
float height;
TextAnchor xanchor;
TextAnchor yanchor;
SDL_Color color;
float width;
GLuint texture;
GLuint vbo;
void Rebuild();
public:
LabelWidget(Screen *screen, const string &text, float x, float y, float height, TextAnchor xanchor, TextAnchor yanchor, const SDL_Color &color) :
Widget(screen),
text(text),
x(x),
y(y),
height(height),
xanchor(xanchor),
yanchor(yanchor),
color(color),
vbo(0),
texture(0)
{
this->Reset();
}
virtual ~LabelWidget();
void SetText(const string &text);
const string &GetText() const;
void SetColor(const SDL_Color &c);
const SDL_Color &GetColor() const;
virtual void HandleEvent(const SDL_Event &e);
virtual void Advance(float dt);
virtual void Render(Renderer *renderer);
virtual void Reset();
};
#endif /* _GRAVITY_LABEL_WIDGET_HH_ */