Changeset 6502 in orxonox.OLD for branches/network/src/story_entities/simple_game_menu.cc
- Timestamp:
- Jan 11, 2006, 10:49:27 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/story_entities/simple_game_menu.cc
r6501 r6502 19 19 #include "simple_game_menu.h" 20 20 21 #include "state.h" 22 #include "class_list.h" 23 24 #include "load_param.h" 25 #include "fast_factory.h" 26 #include "factory.h" 27 28 #include "world_entity.h" 29 #include "terrain.h" 30 31 #include "cd_engine.h" 32 33 21 34 using namespace std; 22 35 23 36 24 /** 25 * SimpleGameMenu constructor 26 */ 27 SimpleGameMenu::SimpleGameMenu() 37 //! This creates a Factory to fabricate a SimpleGameMenu 38 CREATE_FACTORY(SimpleGameMenu, CL_SIMPLE_GAME_MENU); 39 40 41 42 SimpleGameMenu::SimpleGameMenu(const TiXmlElement* root) 43 : GameWorld(root) 44 { 45 this->setClassID(CL_SIMPLE_GAME_MENU, "SimpleGameMenu"); 46 this->setName("SimpleGameMenu uninitialized"); 47 48 this->dataTank = new SimpleGameMenuData(); 49 50 this->loadParams(root); 51 } 52 53 54 /** 55 * remove the SimpleGameMenu from memory 56 * 57 * delete everything explicitly, that isn't contained in the parenting tree! 58 * things contained in the tree are deleted automaticaly 59 */ 60 SimpleGameMenu::~SimpleGameMenu () 61 { 62 PRINTF(3)("SimpleGameMenu::~SimpleGameMenu() - deleting current world\n"); 63 64 if( this->dataTank) 65 delete this->dataTank; 66 } 67 68 69 /** 70 * loads the parameters of a SimpleGameMenu from an XML-element 71 * @param root the XML-element to load from 72 */ 73 void SimpleGameMenu::loadParams(const TiXmlElement* root) 74 { 75 /* skip the GameWorld, since it does not define any useful loadParams for this class */ 76 static_cast<StoryEntity*>(this)->loadParams(root); 77 78 PRINTF(4)("Loaded SimpleGameMenu specific stuff\n"); 79 } 80 81 82 /** 83 * no collision detection in the menu 84 */ 85 void SimpleGameMenu::collide() 28 86 {} 29 87 30 88 31 /** SimpleGameMenu deconstructor 32 */ 33 SimpleGameMenu::~SimpleGameMenu() 89 90 91 92 93 94 95 96 /********************************************************************************************** 97 SimpleGameMenuData 98 **********************************************************************************************/ 99 100 101 /** 102 * SimpleGameMenuData constructor 103 */ 104 SimpleGameMenuData::SimpleGameMenuData() 34 105 {} 35 106 36 37 /** 38 * init the menu 39 */ 40 ErrorMessage SimpleGameMenu::init() 107 /** 108 * SimpleGameMenuData decontructor 109 */ 110 SimpleGameMenuData::~SimpleGameMenuData() 41 111 {} 42 112 43 113 44 114 /** 45 * load the data 46 */ 47 ErrorMessage SimpleGameMenu::loadData() 48 {} 49 50 51 /** 52 * unload the data again 53 */ 54 ErrorMessage SimpleGameMenu::unloadData() 55 {} 56 57 58 /** 59 * start the menu 60 */ 61 bool SimpleGameMenu::start() 62 {} 63 64 65 /** 66 * stop the menu 67 */ 68 bool SimpleGameMenu::stop() 69 {} 70 71 72 /** 73 * menu running function 74 */ 75 void SimpleGameMenu::run() 76 {} 115 * initialize the GameWorldDataData 116 */ 117 ErrorMessage SimpleGameMenuData::init() 118 { 119 /* call underlying function */ 120 GameWorldData::init(); 121 } 122 123 124 /** 125 * loads the GUI data 126 * @param root reference to the xml root element 127 */ 128 ErrorMessage SimpleGameMenuData::loadGUI(TiXmlElement* root) 129 { 130 /* call underlying function */ 131 GameWorldData::loadGUI(root); 132 } 133 134 135 /** 136 * unloads the GUI data 137 */ 138 ErrorMessage SimpleGameMenuData::unloadGUI() 139 { 140 /* call underlying function */ 141 GameWorldData::unloadGUI(); 142 } 143 144 145 /** 146 * overloads the GameWorld::loadWorldEntities(...) class since the menu WorldEntity loading is different (less loading stuff) 147 * @param root reference to the xml root parameter 148 */ 149 ErrorMessage SimpleGameMenuData::loadWorldEntities(TiXmlElement* root) 150 { 151 TiXmlElement* element = root->FirstChildElement("WorldEntities"); 152 153 if( element != NULL) 154 { 155 element = element->FirstChildElement(); 156 PRINTF(4)("Loading WorldEntities\n"); 157 while( element != NULL) 158 { 159 BaseObject* created = Factory::fabricate(element); 160 if( created != NULL ) 161 printf("Created a %s: %s\n", created->getClassName(), created->getName()); 162 163 if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox")) 164 this->sky = dynamic_cast<WorldEntity*>(created); 165 if( element->Value() != NULL && !strcmp( element->Value(), "Terrain")) 166 { 167 this->terrain = dynamic_cast<Terrain*>(created); 168 CDEngine::getInstance()->setTerrain(terrain); 169 } 170 element = element->NextSiblingElement(); 171 } 172 PRINTF(4)("Done loading WorldEntities\n"); 173 } 174 175 /* init the pnode tree */ 176 PNode::getNullParent()->init(); 177 } 178 179 180 /** 181 * unloads the world entities from the xml file 182 */ 183 ErrorMessage SimpleGameMenuData::unloadWorldEntities() 184 { 185 /* call underlying function */ 186 GameWorldData::unloadWorldEntities(); 187 } 188 189 190 /** 191 * loads the scene data 192 * @param root reference to the xml root element 193 */ 194 ErrorMessage SimpleGameMenuData::loadScene(TiXmlElement* root) 195 { 196 /* call underlying function */ 197 GameWorldData::loadScene(root); 198 } 199 200 201 /** 202 * unloads the scene data 203 */ 204 ErrorMessage SimpleGameMenuData::unloadScene() 205 { 206 /* call underlying function */ 207 GameWorldData::unloadScene(); 208 } 209 210 211
Note: See TracChangeset
for help on using the changeset viewer.