author | andyq <andyq> | 2003-01-21 20:37:00 (UTC) |
---|---|---|
committer | andyq <andyq> | 2003-01-21 20:37:00 (UTC) |
commit | 0a6563fcc2f49857c581d9def24407a3a4ef526c (patch) (side-by-side diff) | |
tree | f1b82a4bd7582ef2cb722cffb87eecff1e1f96e6 /noncore/games/sfcave-sdl/menu.cpp | |
parent | 50b5915b48fc5cbacf23e4d2b75d7a266f141a4a (diff) | |
download | opie-0a6563fcc2f49857c581d9def24407a3a4ef526c.zip opie-0a6563fcc2f49857c581d9def24407a3a4ef526c.tar.gz opie-0a6563fcc2f49857c581d9def24407a3a4ef526c.tar.bz2 |
Clean up of code - fixed memory leaks (most of them) and added new custom config menu
Diffstat (limited to 'noncore/games/sfcave-sdl/menu.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/sfcave-sdl/menu.cpp | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/noncore/games/sfcave-sdl/menu.cpp b/noncore/games/sfcave-sdl/menu.cpp index 0a7366f..a4a4216 100644 --- a/noncore/games/sfcave-sdl/menu.cpp +++ b/noncore/games/sfcave-sdl/menu.cpp @@ -10,3 +10,3 @@ -MenuOption :: MenuOption( QString text, int id ) +MenuOption :: MenuOption( string text, int id ) { @@ -117,2 +117,3 @@ Menu :: Menu( SFCave *p ) // Game Difficulty menu + MenuOption *customMenu = 0; Menu *gameDifficulty = new Menu( options ); @@ -124,2 +125,3 @@ Menu :: Menu( SFCave *p ) item->setNextMenu( options, false ); + customMenu = gameDifficulty->addMenuOption( "Custom", MENU_DIFFICULTY_CUSTOM ); item = gameDifficulty->addMenuOption( "Back", MENU_BACK ); @@ -137,2 +139,25 @@ Menu :: Menu( SFCave *p ) soundsMenu->setNextMenu( sounds ); + + // Custom Menu + Menu *custom = new Menu( gameDifficulty ); + Menu *updown = new Menu( custom ); + item = custom->addMenuOption( "Thrust", MENU_CUSTOM_THRUST ); + item->setNextMenu( updown ); + item = custom->addMenuOption( "Gravity", MENU_CUSTOM_GRAVITY ); + item->setNextMenu( updown ); + item = custom->addMenuOption( "Max Speed Up", MENU_CUSTOM_MAXSPEEDUP ); + item->setNextMenu( updown ); + item = custom->addMenuOption( "Max Speed Down", MENU_CUSTOM_MAXSPEEDDOWN ); + item->setNextMenu( updown ); + item = custom->addMenuOption( "Back", MENU_BACK ); + item->setNextMenu( gameDifficulty, false ); + customMenu->setNextMenu( custom ); + + // Up down menu + item = updown->addMenuOption( "Increase", MENU_CUSTOM_INCREASE ); + item = updown->addMenuOption( "Decrease", MENU_CUSTOM_DECREASE ); + item = updown->addMenuOption( "Save", MENU_CUSTOM_SAVE ); + item->setNextMenu( custom, false ); + item = updown->addMenuOption( "Cancel", MENU_CUSTOM_CANCEL ); + item->setNextMenu( custom, false ); @@ -217,3 +242,2 @@ int Menu :: handleKeys( SDL_KeyboardEvent &key ) - statusText = ""; switch( key.keysym.sym ) @@ -278,4 +302,4 @@ int Menu :: handleKeys( SDL_KeyboardEvent &key ) { + statusText = ""; currentMenu = currentMenu->parentMenu; - printf( "HERE\n" ); @@ -288,5 +312,7 @@ int Menu :: handleKeys( SDL_KeyboardEvent &key ) { + statusText = ""; // select menu item int id = currentMenu->currentMenuOption->getMenuId(); -// // if the current item has a child menu then move to that menu + + // if the current item has a child menu then move to that menu Menu *next = currentMenu->currentMenuOption->getNextMenu(); @@ -298,9 +324,6 @@ int Menu :: handleKeys( SDL_KeyboardEvent &key ) initCurrentMenu(); -// return -1; - } -// else - { - return id; } + return id; + break; @@ -315,3 +338,3 @@ int Menu :: handleKeys( SDL_KeyboardEvent &key ) -MenuOption *Menu :: addMenuOption( QString text, int id ) +MenuOption *Menu :: addMenuOption( string text, int id ) { |