Changeset 6991 in orxonox.OLD for trunk/src/story_entities
- Timestamp:
- Feb 2, 2006, 10:40:20 PM (19 years ago)
- Location:
- trunk/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/simple_game_menu.cc
r6989 r6991 57 57 58 58 this->cameraVector = Vector(50.0, 0.0, 0.0); 59 this->menuLayer .push_back(newMenuLayer());60 this->menuLayer .push_back(newMenuLayer());59 this->menuLayers.push_back(MenuLayer()); 60 this->menuLayers.push_back(MenuLayer()); 61 61 62 62 this->layerIndex = 0; … … 177 177 State::getResY() / 2.0f - 60.0f, 178 178 0.0f); 179 this->menuLayer [0]->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));179 this->menuLayers[0].menuList.push_back(dynamic_cast<ImageEntity*>(*entity)); 180 180 181 181 } … … 185 185 this->menuStartMultiplayerGame->setBindNode((const PNode*)NULL); 186 186 this->menuStartMultiplayerGame->setRelCoor2D(State::getResX() / 2.0f, 187 State::getResY() / 2.0f + ((this->menuLayer [0]->menuList.size() -1 ) * 60.0f),187 State::getResY() / 2.0f + ((this->menuLayers[0].menuList.size() -1 ) * 60.0f), 188 188 0.0f); 189 this->menuLayer [0]->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));189 this->menuLayers[0].menuList.push_back(dynamic_cast<ImageEntity*>(*entity)); 190 190 } 191 191 else if( !strcmp( "Quit_Menu", (*entity)->getName())) … … 194 194 this->menuQuitGame->setBindNode((const PNode*)NULL); 195 195 this->menuQuitGame->setRelCoor2D(State::getResX() / 2.0f, 196 State::getResY() / 2.0f + ((this->menuLayer [0]->menuList.size() -1 )* 60.0f),196 State::getResY() / 2.0f + ((this->menuLayers[0].menuList.size() -1 )* 60.0f), 197 197 0.0f); 198 this->menuLayer [0]->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));198 this->menuLayers[0].menuList.push_back(dynamic_cast<ImageEntity*>(*entity)); 199 199 } 200 200 } 201 201 this->menuSelected->getNullElement()->update2D(0.1f); 202 202 this->menuSelectedIndex = 0; 203 this->menuSelected = this->menuLayer [0]->menuList[this->menuSelectedIndex];203 this->menuSelected = this->menuLayers[0].menuList[this->menuSelectedIndex]; 204 204 this->menuSelector->setAbsCoor2D(this->menuSelected->getAbsCoor2D()); 205 205 … … 213 213 if( se->isContainedInMenu()) 214 214 { 215 this->menuLayer [1]->storyList.push_back(se);215 this->menuLayers[1].storyList.push_back(se); 216 216 217 217 // generating menu item … … 220 220 ie->setVisibility(false); 221 221 ie->setBindNode((const PNode*)NULL); 222 ie->setRelCoor2D(State::getResX() / 2.0f - 200.0f, State::getResY() / 2.0f + ((this->menuLayer [1]->menuList.size() - 2.0f) * 60.0f), 0.0f);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 223 ie->setSize2D(100.0f, 50.0f); 224 this->menuLayer [1]->menuList.push_back(ie);224 this->menuLayers[1].menuList.push_back(ie); 225 225 226 226 // generating screenshoot item … … 231 231 ie->setRelCoor2D(State::getResX() / 2.0f + 250.0f, State::getResY() / 2.0f, 0.0f); 232 232 ie->setSize2D(140.0f, 105.0f); 233 this->menuLayer [1]->screenshootList.push_back(ie);233 this->menuLayers[1].screenshootList.push_back(ie); 234 234 } 235 235 } … … 244 244 245 245 std::vector<ImageEntity*>::iterator it; 246 std::vector<MenuLayer*>::iterator mit; 247 for(mit = this->menuLayer.begin(); mit != this->menuLayer.end(); mit++) 248 { 249 (*mit)->menuList.erase((*mit)->menuList.begin(), (*mit)->menuList.end()); 250 (*mit)->storyList.erase((*mit)->storyList.begin(), (*mit)->storyList.end()); 246 std::vector<MenuLayer>::iterator mit; 247 for(mit = this->menuLayers.begin(); mit != this->menuLayers.end(); mit++) 248 { 249 (*mit).menuList.clear(); //erase((*mit).menuList.begin(), (*mit).menuList.end()); 250 (*mit).storyList.clear(); //erase((*mit).storyList.begin(), (*mit).storyList.end()); 251 (*mit).screenshootList.clear(); 251 252 } 252 253 } … … 329 330 { 330 331 // switch to first submenu 331 if( this->menuLayer [1]->menuList.size() == 0)332 if( this->menuLayers[1].menuList.size() == 0) 332 333 { 333 334 PRINTF(1)("Haven't got any StoryEntities to play!\n"); … … 348 349 if( event.type == SDLK_RETURN && event.bPressed == true) 349 350 { 350 this->setNextStoryID( this->menuLayer [1]->storyList[this->menuSelectedIndex]->getStoryID());351 this->setNextStoryID( this->menuLayers[1].storyList[this->menuSelectedIndex]->getStoryID()); 351 352 this->stop(); 352 353 } … … 362 363 if( event.type == SDLK_DOWN && event.bPressed == true) 363 364 { 364 if(this->menuSelectedIndex < (this->menuLayer [this->layerIndex]->menuList.size() - 1))365 { 366 this->menuSelected = this->menuLayer [this->layerIndex]->menuList[++this->menuSelectedIndex];365 if(this->menuSelectedIndex < (this->menuLayers[this->layerIndex].menuList.size() - 1)) 366 { 367 this->menuSelected = this->menuLayers[this->layerIndex].menuList[++this->menuSelectedIndex]; 367 368 this->menuSelector->setAbsCoor2D(this->menuSelected->getAbsCoor2D()); 368 369 369 370 if( this->layerIndex == 1) 370 371 { 371 this->menuLayer [1]->screenshootList[this->menuSelectedIndex]->setVisibility(true);372 this->menuLayer [1]->screenshootList[this->menuSelectedIndex-1]->setVisibility(false);372 this->menuLayers[1].screenshootList[this->menuSelectedIndex]->setVisibility(true); 373 this->menuLayers[1].screenshootList[this->menuSelectedIndex-1]->setVisibility(false); 373 374 } 374 375 } … … 378 379 if(this->menuSelectedIndex > 0) 379 380 { 380 this->menuSelected = this->menuLayer [this->layerIndex]->menuList[--this->menuSelectedIndex];381 this->menuSelected = this->menuLayers[this->layerIndex].menuList[--this->menuSelectedIndex]; 381 382 this->menuSelector->setAbsCoor2D(this->menuSelected->getAbsCoor2D()); 382 383 383 384 if( this->layerIndex == 1) 384 385 { 385 this->menuLayer [1]->screenshootList[this->menuSelectedIndex]->setVisibility(true);386 this->menuLayer [1]->screenshootList[this->menuSelectedIndex+1]->setVisibility(false);386 this->menuLayers[1].screenshootList[this->menuSelectedIndex]->setVisibility(true); 387 this->menuLayers[1].screenshootList[this->menuSelectedIndex+1]->setVisibility(false); 387 388 } 388 389 } … … 399 400 { 400 401 // wrong sizes 401 if(layer1 >= this->menuLayer .size() || layer2 >= this->menuLayer.size())402 if(layer1 >= this->menuLayers.size() || layer2 >= this->menuLayers.size()) 402 403 return; 403 404 … … 406 407 std::vector<ImageEntity*>::iterator it; 407 408 // fade old menu 408 for( it = this->menuLayer [layer1]->menuList.begin(); it != this->menuLayer[layer1]->menuList.end(); it++)409 for( it = this->menuLayers[layer1].menuList.begin(); it != this->menuLayers[layer1].menuList.end(); it++) 409 410 { 410 411 (*it)->setVisibility(false); 411 412 } 412 413 //also fade the screenshots if in level choosement mode 413 for( it = this->menuLayer [layer1]->screenshootList.begin(); it != this->menuLayer[layer1]->screenshootList.end(); it++)414 for( it = this->menuLayers[layer1].screenshootList.begin(); it != this->menuLayers[layer1].screenshootList.end(); it++) 414 415 { 415 416 (*it)->setVisibility(false); … … 419 420 PRINTF(0)("Showing layer %i\n", layer1); 420 421 // beam here the new menu 421 for( it = this->menuLayer [layer2]->menuList.begin(); it != this->menuLayer[layer2]->menuList.end(); it++ )422 for( it = this->menuLayers[layer2].menuList.begin(); it != this->menuLayers[layer2].menuList.end(); it++ ) 422 423 { 423 424 (*it)->setVisibility(true); … … 426 427 427 428 this->layerIndex = layer2; 428 this->menuSelected = this->menuLayer [layer2]->menuList[0];429 this->menuSelected = this->menuLayers[layer2].menuList[0]; 429 430 this->menuSelector->setAbsCoor2D(this->menuSelected->getAbsCoor2D()); 430 431 this->menuSelectedIndex = 0; 431 432 432 433 if( layer2 == 1) 433 this->menuLayer [layer2]->screenshootList[0]->setVisibility(true);434 this->menuLayers[layer2].screenshootList[0]->setVisibility(true); 434 435 } 435 436 -
trunk/src/story_entities/simple_game_menu.h
r6981 r6991 70 70 71 71 private: 72 std::vector<MenuLayer *> menuLayer;//!< the menu layer72 std::vector<MenuLayer> menuLayers; //!< the menu layer 73 73 MenuLayer* selectedLayer; //!< the selected menu layer 74 74 int layerIndex;
Note: See TracChangeset
for help on using the changeset viewer.