blob: 6a5ef409609e5b0a98e67e44fe3b2fb1dda7a9f7 (
plain)
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
|
#ifndef __MENU_H
#define __MENU_H
#include <list>
using namespace std;
#include <SDL.h>
class SFCave;
class StarField;
class Menu;
class MenuOption
{
public:
MenuOption( string text, int id );
~MenuOption();
void highlight( bool val ) { highlighted = val; }
int draw( SDL_Surface *screen, int y );
void setNextMenu( Menu *item, bool down = true );
Menu *getNextMenu() { return nextMenu; }
int getMenuId() { return menuId; }
bool isDownMenuTree() { return downMenuTree; }
private:
int menuId;
string menuText;
bool highlighted;
bool downMenuTree;
Menu *nextMenu;
};
class Menu
{
public:
Menu( SFCave *p );
~Menu();
void draw( SDL_Surface *screen );
int handleKeys( SDL_KeyboardEvent & );
MenuOption *addMenuOption( string text, int id );
void resetToTopMenu();
void initCurrentMenu();
void setStatusText( string text ) { statusText = text; }
protected:
private:
static SDL_Surface * sfcaveTextImage;
int angle;
static Menu *mainMenu;
static Menu *currentMenu;
Menu *parentMenu;
StarField *stars;
string statusText;
SFCave *parent;
list<MenuOption *> listItems;
MenuOption *currentMenuOption;
Menu( Menu* p );
};
#endif
|