Changeset 6521 in orxonox.OLD for branches/network/src/story_entities
- Timestamp:
- Jan 18, 2006, 1:57:58 AM (19 years ago)
- Location:
- branches/network/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/story_entities/simple_game_menu.cc
r6520 r6521 26 26 #include "factory.h" 27 27 28 #include "p_node.h" 28 29 #include "world_entity.h" 29 30 #include "image_entity.h" 30 31 #include "terrain.h" 32 #include "camera.h" 31 33 32 34 #include "event_handler.h" … … 50 52 51 53 this->dataTank = new SimpleGameMenuData(); 54 55 this->cameraVector = Vector(50.0, 0.0, 0.0); 52 56 53 57 this->loadParams(root); … … 98 102 EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_RETURN); 99 103 EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_SPACE); 100 } 101 102 103 104 bool SimpleGameMenu::start() 105 { 106 EventHandler::getInstance()->pushState(ES_MENU); 107 108 109 // const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE); 110 // assert(playableList != NULL); 111 // std::list<BaseObject*>::const_iterator entity; 104 105 this->dataTank->localCamera->setRelCoor(this->cameraVector); 106 } 107 108 109 ErrorMessage SimpleGameMenu::loadData() 110 { 111 GameWorld::loadData(); 112 112 113 113 /* get the menu list */ … … 144 144 this->menuSelected = this->menuList[this->menuSelectedIndex]; 145 145 this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor()); 146 } 147 148 149 150 bool SimpleGameMenu::start() 151 { 152 EventHandler::getInstance()->pushState(ES_MENU); 146 153 147 154 /* now call the underlying*/ … … 160 167 161 168 162 163 /** 164 * no collision detection in the menu 169 /** 170 * override the standard tick for more functionality 171 */ 172 void SimpleGameMenu::tick() 173 { 174 GameWorld::tick(); 175 176 this->animateScene(this->dt); 177 } 178 179 180 /** 181 * no collision detection in the menu 165 182 */ 166 183 void SimpleGameMenu::collide() 167 {} 184 { 185 // this->dataTank->localCamera-> 186 } 187 188 189 /** 190 * animate the scene 191 */ 192 void SimpleGameMenu::animateScene(float dt) 193 { 194 Quaternion q(0.00005*dt, Vector(0.0, 1.0, 0.0)); 195 this->cameraVector = q.apply(this->cameraVector); 196 this->dataTank->localCamera->setRelCoor(this->cameraVector); 197 this->dataTank->localCamera->getTarget()->setRelCoorSoft(0,0,0); 198 } 168 199 169 200 … … 174 205 void SimpleGameMenu::process(const Event &event) 175 206 { 176 PRINTF(0)("Got Event: %i\n", event.type);177 178 207 if( event.type == SDLK_RETURN) 179 208 { 180 209 if( this->menuSelected == this->menuQuitGame) 181 210 { 182 this->setNextStoryID( 999);211 this->setNextStoryID(WORLD_ID_GAMEEND); 183 212 this->stop(); 184 213 } -
branches/network/src/story_entities/simple_game_menu.h
r6520 r6521 12 12 #include "game_world_data.h" 13 13 #include <vector> 14 #include "vector.h" 14 15 15 16 … … 33 34 34 35 virtual ErrorMessage init(); 36 virtual ErrorMessage loadData(); 37 35 38 virtual bool start(); 36 39 virtual bool stop(); … … 40 43 41 44 protected: 45 virtual void tick(); 42 46 virtual void collide(); 47 48 49 private: 50 void animateScene(float dt); 43 51 44 52 … … 51 59 ImageEntity* menuQuitGame; 52 60 int menuSelectedIndex; 61 62 Vector cameraVector; 53 63 }; 54 64
Note: See TracChangeset
for help on using the changeset viewer.