-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenuscreen.h
77 lines (63 loc) · 1.42 KB
/
menuscreen.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
75
76
#pragma once
#include <SDL2/SDL.h>
#include "font.h"
#include <vector>
#include "config.h"
class MenuScreen
{
public:
enum MenuReturn
{
MENURET_PLAY,
MENURET_QUIT,
MENURET_NOTHING
};
MenuScreen();
void Render(SDL_Surface* src, SDL_Surface* dest, Font& font);
void Clock() { timer++; };
MenuReturn Update(SDL_Event& tevent);
private:
enum MenuEntryAction
{
ACTION_SWITCHMENU,
ACTION_BOOL,
ACTION_INT,
ACTION_RETURN
};
struct MenuEntry
{
std::string name;
int(*getval)();
void(*setval)(int);
MenuEntryAction action;
int arg;
MenuEntry(std::string _name, MenuEntryAction _action, int _arg, int(*_getval)(), void(*_setval)(int))
{
arg = _arg;
name = _name;
action = _action;
getval = _getval;
setval = _setval;
};
};
enum MENUSTATUS
{
MENUSTATUS_MAIN,
MENUSTATUS_KEYCONFIG,
MENUSTATUS_SOUNDOPTIONS,
MENUSTATUS_CONTROLOPTIONS,
MENUSTATUS_DISPLAYOPTIONS
};
MENUSTATUS status;
int selection;
int timer;
MenuReturn HandleMainMenu(SDL_Keycode sym);
void HandleKeyMenu(SDL_Keycode sym);
void HandleSoundMenu(SDL_Keycode sym);
void DisplayStandardMenu(std::vector<MenuEntry>& menu, bool flash, int scale, SDL_Surface* dest, Font& font);
MenuReturn HandleStandardMenu(SDL_Keycode sym, std::vector<MenuEntry>& menu);
std::vector<MenuEntry> soundmenu;
std::vector<MenuEntry> mainmenu;
std::vector<MenuEntry> controlmenu;
std::vector<MenuEntry> displaymenu;
};