Diffstat (limited to 'noncore/games/sfcave-sdl/menu.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/games/sfcave-sdl/menu.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/noncore/games/sfcave-sdl/menu.h b/noncore/games/sfcave-sdl/menu.h new file mode 100644 index 0000000..08f7528 --- a/dev/null +++ b/noncore/games/sfcave-sdl/menu.h | |||
@@ -0,0 +1,71 @@ | |||
1 | #ifndef __MENU_H | ||
2 | #define __MENU_H | ||
3 | |||
4 | #include <list> | ||
5 | using namespace std; | ||
6 | |||
7 | #include <SDL.h> | ||
8 | |||
9 | class SFCave; | ||
10 | class StarField; | ||
11 | class Menu; | ||
12 | |||
13 | class MenuOption | ||
14 | { | ||
15 | public: | ||
16 | MenuOption( QString text, int id ); | ||
17 | ~MenuOption(); | ||
18 | |||
19 | void highlight( bool val ) { highlighted = val; } | ||
20 | int draw( SDL_Surface *screen, int y ); | ||
21 | void setNextMenu( Menu *item, bool down = true ); | ||
22 | Menu *getNextMenu() { return nextMenu; } | ||
23 | int getMenuId() { return menuId; } | ||
24 | bool isDownMenuTree() { return downMenuTree; } | ||
25 | |||
26 | private: | ||
27 | int menuId; | ||
28 | QString menuText; | ||
29 | bool highlighted; | ||
30 | bool downMenuTree; | ||
31 | |||
32 | Menu *nextMenu; | ||
33 | }; | ||
34 | |||
35 | class Menu | ||
36 | { | ||
37 | public: | ||
38 | Menu( SFCave *p ); | ||
39 | ~Menu(); | ||
40 | |||
41 | void draw( SDL_Surface *screen ); | ||
42 | int handleKeys( SDL_KeyboardEvent & ); | ||
43 | MenuOption *addMenuOption( QString text, int id ); | ||
44 | void resetToTopMenu(); | ||
45 | void initCurrentMenu(); | ||
46 | |||
47 | void setStatusText( QString text ) { statusText = text; } | ||
48 | |||
49 | protected: | ||
50 | |||
51 | private: | ||
52 | static SDL_Surface * sfcaveTextImage; | ||
53 | int angle; | ||
54 | |||
55 | static Menu *mainMenu; | ||
56 | static Menu *currentMenu; | ||
57 | Menu *parentMenu; | ||
58 | |||
59 | StarField *stars; | ||
60 | |||
61 | QString statusText; | ||
62 | |||
63 | SFCave *parent; | ||
64 | list<MenuOption *> listItems; | ||
65 | MenuOption *currentMenuOption; | ||
66 | |||
67 | Menu( Menu* p ); | ||
68 | }; | ||
69 | |||
70 | |||
71 | #endif | ||