00001 #ifndef __MENU_H 00002 #define __MENU_H 00003 00004 #include <list> 00005 using namespace std; 00006 00007 #include <SDL/SDL.h> 00008 00009 class SFCave; 00010 class StarField; 00011 class Menu; 00012 00013 class MenuOption 00014 { 00015 public: 00016 MenuOption( string text, int id ); 00017 ~MenuOption(); 00018 00019 void highlight( bool val ) { highlighted = val; } 00020 int draw( SDL_Surface *screen, int y ); 00021 void setNextMenu( Menu *item, bool down = true ); 00022 Menu *getNextMenu() { return nextMenu; } 00023 int getMenuId() { return menuId; } 00024 bool isDownMenuTree() { return downMenuTree; } 00025 00026 private: 00027 int menuId; 00028 string menuText; 00029 bool highlighted; 00030 bool downMenuTree; 00031 00032 Menu *nextMenu; 00033 }; 00034 00035 class Menu 00036 { 00037 public: 00038 Menu( SFCave *p ); 00039 ~Menu(); 00040 00041 void draw( SDL_Surface *screen ); 00042 int handleKeys( SDL_KeyboardEvent & ); 00043 MenuOption *addMenuOption( string text, int id ); 00044 void resetToTopMenu(); 00045 void initCurrentMenu(); 00046 00047 void setStatusText( string text ) { statusText = text; } 00048 00049 protected: 00050 00051 private: 00052 static SDL_Surface * sfcaveTextImage; 00053 int angle; 00054 00055 static Menu *mainMenu; 00056 static Menu *currentMenu; 00057 Menu *parentMenu; 00058 00059 StarField *stars; 00060 00061 string statusText; 00062 00063 SFCave *parent; 00064 list<MenuOption *> listItems; 00065 MenuOption *currentMenuOption; 00066 00067 Menu( Menu* p ); 00068 }; 00069 00070 00071 #endif
1.4.2