-
Notifications
You must be signed in to change notification settings - Fork 0
/
button.h
74 lines (56 loc) · 2.43 KB
/
button.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef BUTTON_H
#define BUTTON_H
#include "Texture.h"
//buttons on the title screen + back button for screens like options
const int TOTAL_BUTTONS = 15;
const int BUTTON_WIDTH = 160;
const int BUTTON_HEIGHT = 120;
//buttons in the menubar plus save & quit button .
const static int TOTAL_CHAPTER_BUTTONS=9;
//new game, load game, options, credits, back button, chapters 1,2,3, and fullscreen on/off button.
const static int TOTAL_PREGAME_BUTTONS = 12;
//gamestate=6, stage1 buttons
const static int TOTAL_STAGE_BUTTONS = 1;
class button
{
public:
//Initializes internal variables
button();
~button();
//Sets top left position
void setPosition( int x, int y );
int getPositionX();
int getPositionY();
bool fullScreen;
bool musicOn;
bool voiceOn;
//Handles pre-game user interface mouse events (mainly button clicks, like new game, load game, options, credits, etc)
int handlePGUIEvent( int gameState, std::string buttonName, SDL_Event* e, SDL_Window* window,SDL_Renderer* renderer );
//handles buttons while player is in a chapter (menu bar buttons like backline, backpage, auto text speed, auto text toggle, and save + exit button
int handleChapterEvent( std::string buttonName, SDL_Event* e, SDL_Window* window,SDL_Renderer* renderer );
//handles mouse events in stages (currently not in use.
int handleStageEvent( int gameState, std::string buttonName, SDL_Event* e, SDL_Window* window,SDL_Renderer* renderer );
Texture buttonTexture;
bool setFullScreenOn(SDL_Window* window,SDL_Renderer* renderer);
bool setFullScreenOff(SDL_Window* window,SDL_Renderer* renderer);
bool setMusicOn();
bool setMusicOff();
bool setVoiceOn();
bool setVoiceOff();
std::string buttonName;
std::string pregameButtonNames[TOTAL_PREGAME_BUTTONS];
std::string chapterButtonNames[TOTAL_CHAPTER_BUTTONS];
std::string stageButtonNames[TOTAL_STAGE_BUTTONS];
//each button has a string that describes the button.
void setChapterButtonName(int i);
void setPregameButtonName(int i);
void setStageButtonName(int i);
//determines which texture to show in options screen, red or green.
void fullScreenButtonTextureToggle(SDL_Renderer* renderer);
void musicButtonTextureToggle(SDL_Renderer* renderer);
void voiceButtonTextureToggle(SDL_Renderer* renderer);
private:
//Top left point of button image location
SDL_Point position;
};
#endif // BUTTON_H