Changeset 6520 in orxonox.OLD for branches/network/src/story_entities/simple_game_menu.cc
- Timestamp:
- Jan 18, 2006, 12:58:14 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/story_entities/simple_game_menu.cc
r6504 r6520 27 27 28 28 #include "world_entity.h" 29 #include "image_entity.h" 29 30 #include "terrain.h" 30 31 … … 105 106 EventHandler::getInstance()->pushState(ES_MENU); 106 107 108 109 // const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE); 110 // assert(playableList != NULL); 111 // std::list<BaseObject*>::const_iterator entity; 112 113 /* get the menu list */ 114 const std::list<BaseObject*>* imageEntityList = ClassList::getList(CL_IMAGE_ENTITY); 115 std::list<BaseObject*>::const_iterator entity; 116 for (entity = imageEntityList->begin(); entity != imageEntityList->end(); entity++) 117 { 118 119 if( !strcmp("Selector_Menu", (*entity)->getName())) 120 { 121 this->menuSelector = dynamic_cast<ImageEntity*>(*entity); 122 PRINTF(0)("Found the selector: %s\n", (*entity)->getName()); 123 } 124 else if( !strcmp( "StartGame_Menu", (*entity)->getName())) 125 { 126 PRINTF(0)("Found a StartItem: %s\n", (*entity)->getName()); 127 this->menuStartGame = dynamic_cast<ImageEntity*>(*entity); 128 this->menuList.push_back(dynamic_cast<ImageEntity*>(*entity)); 129 } 130 else if( !strcmp( "Multiplayer_Menu", (*entity)->getName())) 131 { 132 PRINTF(0)("Found a MultiplayerItem: %s\n", (*entity)->getName()); 133 this->menuStartMultiplayerGame = dynamic_cast<ImageEntity*>(*entity); 134 this->menuList.push_back(dynamic_cast<ImageEntity*>(*entity)); 135 } 136 else if( !strcmp( "Quit_Menu", (*entity)->getName())) 137 { 138 PRINTF(0)("Found a QuitItem: %s\n", (*entity)->getName()); 139 this->menuQuitGame = dynamic_cast<ImageEntity*>(*entity); 140 this->menuList.push_back(dynamic_cast<ImageEntity*>(*entity)); 141 } 142 } 143 this->menuSelectedIndex = 0; 144 this->menuSelected = this->menuList[this->menuSelectedIndex]; 145 this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor()); 146 107 147 /* now call the underlying*/ 108 148 GameWorld::start(); … … 138 178 if( event.type == SDLK_RETURN) 139 179 { 140 this->stop(); 180 if( this->menuSelected == this->menuQuitGame) 181 { 182 this->setNextStoryID(999); 183 this->stop(); 184 } 185 if( this->menuSelected == this->menuStartGame) 186 { 187 this->stop(); 188 } 189 } 190 else if( event.type == SDLK_DOWN && event.bPressed == true) 191 { 192 // ImageEntity* 193 if(this->menuSelectedIndex < (this->menuList.size() - 1)) 194 { 195 this->menuSelected = this->menuList[++this->menuSelectedIndex]; 196 this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor()); 197 } 198 } 199 else if( event.type == SDLK_UP && event.bPressed == true) 200 { 201 if(this->menuSelectedIndex > 0) 202 { 203 this->menuSelected = this->menuList[--this->menuSelectedIndex]; 204 this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor()); 205 } 141 206 } 142 207 }
Note: See TracChangeset
for help on using the changeset viewer.