Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7063 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Feb 6, 2006, 10:12:34 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: better MenuSelector

Location:
trunk/src/story_entities
Files:
2 edited

Legend:

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

    r7032 r7063  
    207207  this->menuSelectedIndex = 0;
    208208  this->menuSelected = this->menuLayers[0].menuList[this->menuSelectedIndex];
    209   this->menuSelector->setAbsCoor2D(this->menuSelected->getAbsCoor2D());
     209  this->sliderTo(this->menuSelected, 0.0f);
    210210
    211211
     
    376376    {
    377377      this->menuSelected = this->menuLayers[this->layerIndex].menuList[++this->menuSelectedIndex];
    378       this->menuSelector->setAbsCoorSoft2D(this->menuSelected->getAbsCoor2D() + Vector(0, this->menuSelected->getSizeY2D() *.5,0), 3.0);
    379       this->menuSelector->setSizeSoft2D(this->menuSelected->getSizeX2D(), this->menuSelected->getSizeY2D(), 3.0);
     378      this->sliderTo(this->menuSelected, 5.0f);
    380379
    381380      if( this->layerIndex == 1)
     
    391390    {
    392391      this->menuSelected = this->menuLayers[this->layerIndex].menuList[--this->menuSelectedIndex];
    393       this->menuSelector->setAbsCoorSoft2D(this->menuSelected->getAbsCoor2D() + Vector(0, this->menuSelected->getSizeY2D() *.5,0), 3.0);
    394       this->menuSelector->setSizeSoft2D(this->menuSelected->getSizeX2D(), this->menuSelected->getSizeY2D(), 3.0);
     392      this->sliderTo(this->menuSelected, 5.0f);
    395393
    396394      if( this->layerIndex == 1)
     
    450448}
    451449
     450void SimpleGameMenu::sliderTo(const Element2D* element, float bias)
     451{
     452  if (bias > 0.0)
     453  {
     454    this->menuSelector->setAbsCoorSoft2D(element->getAbsCoor2D() + Vector(0, element->getSizeY2D() *.5,0), bias);
     455    this->menuSelector->setSizeSoft2D(element->getSizeX2D(), element->getSizeY2D(), bias);
     456  }
     457  else
     458  {
     459    this->menuSelector->setAbsCoor2D(element->getAbsCoor2D() + Vector(0, element->getSizeY2D() *.5,0));
     460    this->menuSelector->setSize2D(element->getSizeX2D(), element->getSizeY2D());
     461  }
     462}
    452463
    453464
  • trunk/src/story_entities/simple_game_menu.h

    r7019 r7063  
    6969    void animateScene(float dt);
    7070    void switchMenuLayer(int layer1, int layer2);
     71    void sliderTo(const Element2D* element, float bias = 0.0f);
    7172
    7273
Note: See TracChangeset for help on using the changeset viewer.