-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLButton.h
More file actions
45 lines (36 loc) · 839 Bytes
/
LButton.h
File metadata and controls
45 lines (36 loc) · 839 Bytes
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
#ifndef LButton_h
#define LButton_h
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
#include <stdio.h>
#include <string>
//Set the enumeration of the states of the buttons
enum LButtonSprite
{
BUTTON_SPRITE_MOUSE_OUT = 0,
BUTTON_SPRITE_MOUSE_OVER_MOTION = 1,
BUTTON_SPRITE_MOUSE_DOWN = 2,
BUTTON_SPRITE_MOUSE_UP = 3,
BUTTON_SPRITE_TOTAL = 13
};
class LButton
{
public:
//Initializes internal variables
LButton();
//Sets top left position
void setPosition( int x, int y );
//Handles mouse event
void handleEvent( SDL_Event* e, int );
//Shows button sprite
void render(int);
int getenum();
int clickCount;
private:
//Top left position
SDL_Point mPosition;
//Currently used global sprite
LButtonSprite mCurrentSprite;
};
#endif /* LButton_h */