Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6991 in orxonox.OLD for trunk/src/story_entities


Ignore:
Timestamp:
Feb 2, 2006, 10:40:20 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: fixed the Bug with the Menu loosing its frames

Location:
trunk/src/story_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/simple_game_menu.cc

    r6989 r6991  
    5757
    5858  this->cameraVector = Vector(50.0, 0.0, 0.0);
    59   this->menuLayer.push_back(new MenuLayer());
    60   this->menuLayer.push_back(new MenuLayer());
     59  this->menuLayers.push_back(MenuLayer());
     60  this->menuLayers.push_back(MenuLayer());
    6161
    6262  this->layerIndex = 0;
     
    177177                                        State::getResY() / 2.0f - 60.0f,
    178178                                        0.0f);
    179       this->menuLayer[0]->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
     179      this->menuLayers[0].menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
    180180
    181181    }
     
    185185      this->menuStartMultiplayerGame->setBindNode((const PNode*)NULL);
    186186      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),
    188188                                                   0.0f);
    189       this->menuLayer[0]->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
     189      this->menuLayers[0].menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
    190190    }
    191191    else if( !strcmp( "Quit_Menu", (*entity)->getName()))
     
    194194      this->menuQuitGame->setBindNode((const PNode*)NULL);
    195195      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),
    197197                                       0.0f);
    198       this->menuLayer[0]->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
     198      this->menuLayers[0].menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
    199199    }
    200200  }
    201201  this->menuSelected->getNullElement()->update2D(0.1f);
    202202  this->menuSelectedIndex = 0;
    203   this->menuSelected = this->menuLayer[0]->menuList[this->menuSelectedIndex];
     203  this->menuSelected = this->menuLayers[0].menuList[this->menuSelectedIndex];
    204204  this->menuSelector->setAbsCoor2D(this->menuSelected->getAbsCoor2D());
    205205
     
    213213    if( se->isContainedInMenu())
    214214    {
    215       this->menuLayer[1]->storyList.push_back(se);
     215      this->menuLayers[1].storyList.push_back(se);
    216216
    217217      // generating menu item
     
    220220      ie->setVisibility(false);
    221221      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);
    223223      ie->setSize2D(100.0f, 50.0f);
    224       this->menuLayer[1]->menuList.push_back(ie);
     224      this->menuLayers[1].menuList.push_back(ie);
    225225
    226226      // generating screenshoot item
     
    231231      ie->setRelCoor2D(State::getResX() / 2.0f + 250.0f, State::getResY() / 2.0f, 0.0f);
    232232      ie->setSize2D(140.0f, 105.0f);
    233       this->menuLayer[1]->screenshootList.push_back(ie);
     233      this->menuLayers[1].screenshootList.push_back(ie);
    234234    }
    235235  }
     
    244244
    245245  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();
    251252  }
    252253}
     
    329330      {
    330331        // switch to first submenu
    331         if( this->menuLayer[1]->menuList.size() == 0)
     332        if( this->menuLayers[1].menuList.size() == 0)
    332333        {
    333334          PRINTF(1)("Haven't got any StoryEntities to play!\n");
     
    348349    if( event.type == SDLK_RETURN && event.bPressed == true)
    349350    {
    350       this->setNextStoryID( this->menuLayer[1]->storyList[this->menuSelectedIndex]->getStoryID());
     351      this->setNextStoryID( this->menuLayers[1].storyList[this->menuSelectedIndex]->getStoryID());
    351352      this->stop();
    352353    }
     
    362363  if( event.type == SDLK_DOWN && event.bPressed == true)
    363364  {
    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];
    367368      this->menuSelector->setAbsCoor2D(this->menuSelected->getAbsCoor2D());
    368369
    369370      if( this->layerIndex == 1)
    370371      {
    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);
    373374      }
    374375    }
     
    378379    if(this->menuSelectedIndex > 0)
    379380    {
    380       this->menuSelected = this->menuLayer[this->layerIndex]->menuList[--this->menuSelectedIndex];
     381      this->menuSelected = this->menuLayers[this->layerIndex].menuList[--this->menuSelectedIndex];
    381382      this->menuSelector->setAbsCoor2D(this->menuSelected->getAbsCoor2D());
    382383
    383384      if( this->layerIndex == 1)
    384385      {
    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);
    387388      }
    388389    }
     
    399400{
    400401  // wrong sizes
    401   if(layer1 >= this->menuLayer.size() || layer2 >= this->menuLayer.size())
     402  if(layer1 >= this->menuLayers.size() || layer2 >= this->menuLayers.size())
    402403    return;
    403404
     
    406407  std::vector<ImageEntity*>::iterator it;
    407408  // 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++)
    409410  {
    410411    (*it)->setVisibility(false);
    411412  }
    412413  //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++)
    414415  {
    415416    (*it)->setVisibility(false);
     
    419420  PRINTF(0)("Showing layer %i\n", layer1);
    420421  // 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++ )
    422423  {
    423424    (*it)->setVisibility(true);
     
    426427
    427428  this->layerIndex = layer2;
    428   this->menuSelected = this->menuLayer[layer2]->menuList[0];
     429  this->menuSelected = this->menuLayers[layer2].menuList[0];
    429430  this->menuSelector->setAbsCoor2D(this->menuSelected->getAbsCoor2D());
    430431  this->menuSelectedIndex = 0;
    431432
    432433  if( layer2 == 1)
    433     this->menuLayer[layer2]->screenshootList[0]->setVisibility(true);
     434    this->menuLayers[layer2].screenshootList[0]->setVisibility(true);
    434435}
    435436
  • trunk/src/story_entities/simple_game_menu.h

    r6981 r6991  
    7070
    7171  private:
    72     std::vector<MenuLayer*>           menuLayer;                       //!< the menu layer
     72    std::vector<MenuLayer>            menuLayers;                      //!< the menu layer
    7373    MenuLayer*                        selectedLayer;                   //!< the selected menu layer
    7474    int                               layerIndex;
Note: See TracChangeset for help on using the changeset viewer.