Changeset 6504 in orxonox.OLD for branches/network/src/story_entities/simple_game_menu.cc
- Timestamp:
- Jan 12, 2006, 1:13:20 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/story_entities/simple_game_menu.cc
r6502 r6504 29 29 #include "terrain.h" 30 30 31 #include "event_handler.h" 32 31 33 #include "cd_engine.h" 32 34 … … 74 76 { 75 77 /* skip the GameWorld, since it does not define any useful loadParams for this class */ 76 static_cast< StoryEntity*>(this)->loadParams(root);78 static_cast<GameWorld*>(this)->loadParams(root); 77 79 78 80 PRINTF(4)("Loaded SimpleGameMenu specific stuff\n"); 79 81 } 82 83 84 /** 85 * this is executed just before load 86 * 87 * since the load function sometimes needs data, that has been initialized 88 * before the load and after the proceeding storyentity has finished 89 */ 90 ErrorMessage SimpleGameMenu::init() 91 { 92 /* call underlying init funciton */ 93 GameWorld::init(); 94 95 EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_UP); 96 EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_DOWN); 97 EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_RETURN); 98 EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_SPACE); 99 } 100 101 102 103 bool SimpleGameMenu::start() 104 { 105 EventHandler::getInstance()->pushState(ES_MENU); 106 107 /* now call the underlying*/ 108 GameWorld::start(); 109 } 110 111 112 113 bool SimpleGameMenu::stop() 114 { 115 EventHandler::getInstance()->popState(); 116 117 /* now call the underlying*/ 118 GameWorld::stop(); 119 } 120 80 121 81 122 … … 87 128 88 129 89 130 /** 131 * event dispatcher funciton 132 * @param event the incoming event 133 */ 134 void SimpleGameMenu::process(const Event &event) 135 { 136 PRINTF(0)("Got Event: %i\n", event.type); 137 138 if( event.type == SDLK_RETURN) 139 { 140 this->stop(); 141 } 142 } 90 143 91 144 … … 164 217 this->sky = dynamic_cast<WorldEntity*>(created); 165 218 if( element->Value() != NULL && !strcmp( element->Value(), "Terrain")) 166 {167 219 this->terrain = dynamic_cast<Terrain*>(created); 168 CDEngine::getInstance()->setTerrain(terrain);169 }170 220 element = element->NextSiblingElement(); 171 221 }
Note: See TracChangeset
for help on using the changeset viewer.