Changeset 7019 in orxonox.OLD for trunk/src/story_entities
- Timestamp:
- Feb 3, 2006, 4:33:45 PM (19 years ago)
- Location:
- trunk/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/simple_game_menu.cc
r7016 r7019 170 170 this->menuSelector->setBindNode((const PNode*)NULL); 171 171 } 172 else if( !strcmp( "StartGame_Menu", (*entity)->getName())) 173 { 174 this->menuStartGame = dynamic_cast<ImageEntity*>(*entity); 172 } 173 174 imageEntityList = ClassList::getList(CL_TEXT_ELEMENT); 175 for (entity = imageEntityList->begin(); entity != imageEntityList->end(); entity++) 176 { 177 if( !strcmp( "StartGame_Menu", (*entity)->getName())) 178 { 179 this->menuStartGame = dynamic_cast<TextElement*>(*entity); 175 180 this->menuStartGame->setBindNode((const PNode*)NULL); 176 181 this->menuStartGame->setRelCoor2D(State::getResX() / 2.0f, 177 182 State::getResY() / 2.0f - 60.0f, 178 183 0.0f); 179 this->menuLayers[0].menuList.push_back(dynamic_cast< ImageEntity*>(*entity));184 this->menuLayers[0].menuList.push_back(dynamic_cast<TextElement*>(*entity)); 180 185 181 186 } 182 187 else if( !strcmp( "Multiplayer_Menu", (*entity)->getName())) 183 188 { 184 this->menuStartMultiplayerGame = dynamic_cast< ImageEntity*>(*entity);189 this->menuStartMultiplayerGame = dynamic_cast<TextElement*>(*entity); 185 190 this->menuStartMultiplayerGame->setBindNode((const PNode*)NULL); 186 191 this->menuStartMultiplayerGame->setRelCoor2D(State::getResX() / 2.0f, 187 192 State::getResY() / 2.0f + ((this->menuLayers[0].menuList.size() -1 ) * 60.0f), 188 193 0.0f); 189 this->menuLayers[0].menuList.push_back(dynamic_cast< ImageEntity*>(*entity));194 this->menuLayers[0].menuList.push_back(dynamic_cast<TextElement*>(*entity)); 190 195 } 191 196 else if( !strcmp( "Quit_Menu", (*entity)->getName())) 192 197 { 193 this->menuQuitGame = dynamic_cast< ImageEntity*>(*entity);198 this->menuQuitGame = dynamic_cast<TextElement*>(*entity); 194 199 this->menuQuitGame->setBindNode((const PNode*)NULL); 195 200 this->menuQuitGame->setRelCoor2D(State::getResX() / 2.0f, 196 201 State::getResY() / 2.0f + ((this->menuLayers[0].menuList.size() -1 )* 60.0f), 197 202 0.0f); 198 this->menuLayers[0].menuList.push_back(dynamic_cast< ImageEntity*>(*entity));203 this->menuLayers[0].menuList.push_back(dynamic_cast<TextElement*>(*entity)); 199 204 } 200 205 } … … 216 221 217 222 // generating menu item 223 TextElement* te = new TextElement(); 224 te->setVisibility(false); 225 te->setText(se->getName()); 226 te->setRelCoor2D(State::getResX() / 2.0f - 200.0f, State::getResY() / 2.0f + ((this->menuLayers[1].menuList.size() - 2.0f) * 60.0f), 0.0f); 227 this->menuLayers[1].menuList.push_back(te); 228 229 // generating screenshoot item 218 230 ImageEntity* ie = new ImageEntity(); 219 ie->setTexture(se->getMenuItemImage());220 231 ie->setVisibility(false); 221 232 ie->setBindNode((const PNode*)NULL); 222 ie->setRelCoor2D(State::getResX() / 2.0f - 200.0f, State::getResY() / 2.0f + ((this->menuLayers[1].menuList.size() - 2.0f) * 60.0f), 0.0f);223 ie->setSize2D(100.0f, 50.0f);224 this->menuLayers[1].menuList.push_back(ie);225 226 // generating screenshoot item227 ie = new ImageEntity();228 233 ie->setTexture(se->getMenuScreenshoot()); 229 ie->setVisibility(false);230 ie->setBindNode((const PNode*)NULL);231 234 ie->setRelCoor2D(State::getResX() / 2.0f + 250.0f, State::getResY() / 2.0f, 0.0f); 232 235 ie->setSize2D(140.0f, 105.0f); … … 246 249 for(mit = this->menuLayers.begin(); mit != this->menuLayers.end(); mit++) 247 250 { 248 (*mit).menuList.clear(); //erase((*mit).menuList.begin(), (*mit).menuList.end()); 249 (*mit).storyList.clear(); //erase((*mit).storyList.begin(), (*mit).storyList.end()); 251 while(!(*mit).menuList.empty()) 252 { 253 delete (*mit).menuList.back(); 254 (*mit).menuList.pop_back(); 255 } 256 257 (*mit).menuList.clear(); 258 (*mit).storyList.clear(); 250 259 (*mit).screenshootList.clear(); 251 260 } … … 404 413 405 414 PRINTF(0)("Removing layer %i\n", layer1); 415 std::vector<TextElement*>::iterator te; 416 // fade old menu 417 for( te = this->menuLayers[layer1].menuList.begin(); te != this->menuLayers[layer1].menuList.end(); te++) 418 { 419 (*te)->setVisibility(false); 420 } 421 406 422 std::vector<ImageEntity*>::iterator it; 407 // fade old menu 408 for( it = this->menuLayers[layer1].menuList.begin(); it != this->menuLayers[layer1].menuList.end(); it++) 409 { 410 (*it)->setVisibility(false); 411 } 423 412 424 //also fade the screenshots if in level choosement mode 413 425 for( it = this->menuLayers[layer1].screenshootList.begin(); it != this->menuLayers[layer1].screenshootList.end(); it++) … … 419 431 PRINTF(0)("Showing layer %i\n", layer1); 420 432 // beam here the new menu 421 for( it = this->menuLayers[layer2].menuList.begin(); it != this->menuLayers[layer2].menuList.end(); it++ )422 { 423 (* it)->setVisibility(true);433 for( te = this->menuLayers[layer2].menuList.begin(); te != this->menuLayers[layer2].menuList.end(); te++ ) 434 { 435 (*te)->setVisibility(true); 424 436 } 425 437 -
trunk/src/story_entities/simple_game_menu.h
r6991 r7019 15 15 16 16 17 #include "elements/text_element.h" 18 17 19 class SimpleGameMenuData; 18 20 class TiXmlElement; … … 29 31 30 32 public: 31 std::vector< ImageEntity*>menuList; //!< the list of the menu items33 std::vector<TextElement*> menuList; //!< the list of the menu items 32 34 std::vector<StoryEntity*> storyList; //!< the list of the StoryEntities for the menu 33 35 std::vector<ImageEntity*> screenshootList; //!< list of the screen shoots FIXME: make a better structure for this stuff … … 75 77 76 78 //std::vector<ImageEntity*> menuList; //!< the list of the menu items 77 ImageEntity* menuSelected; //!< ref to the selected menu entity78 79 ImageEntity* menuSelector; //!< ref to the selector image 79 ImageEntity* menuStartGame; 80 ImageEntity* menuStartMultiplayerGame; 81 ImageEntity* menuQuitGame; 80 TextElement* menuSelected; //!< ref to the selected menu entity 81 TextElement* menuStartGame; 82 TextElement* menuStartMultiplayerGame; 83 TextElement* menuQuitGame; 82 84 int menuSelectedIndex; 83 85
Note: See TracChangeset
for help on using the changeset viewer.