-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbutton-widget.hh
More file actions
47 lines (38 loc) · 1.07 KB
/
Copy pathbutton-widget.hh
File metadata and controls
47 lines (38 loc) · 1.07 KB
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
#ifndef _GRAVITY_BUTTON_WIDGET_HH_
#define _GRAVITY_BUTTON_WIDGET_HH_
#include "label-widget.hh"
#include <string>
using namespace std;
#define BUTTON_CLICK 1000
#define BUTTON_MOUSE_ENTER 1001
#define BUTTON_MOUSE_LEAVE 1002
class ButtonWidget : public LabelWidget {
protected:
SDL_Color activeColor;
SDL_Color inactiveColor;
bool isActive;
bool mouseDown;
public:
ButtonWidget(Screen *screen,
string text,
float x,
float y,
float height,
TextAnchor xanchor,
TextAnchor yanchor,
const SDL_Color &activeColor,
const SDL_Color &inactiveColor) :
LabelWidget(screen, text, x, y, height, xanchor, yanchor, inactiveColor),
activeColor(activeColor),
inactiveColor(inactiveColor),
isActive(false),
mouseDown(false)
{
this->SetText(text);
}
virtual void HandleEvent(const SDL_Event &e);
virtual void Advance(float dt);
virtual void Render(Renderer *renderer);
virtual void Reset();
};
#endif /* _GRAVITY_BUTTON_WIDGET_HH_ */