Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6835 in orxonox.OLD


Ignore:
Timestamp:
Jan 29, 2006, 11:59:39 PM (18 years ago)
Author:
patrick
Message:

trunk: resturcture of the game menu for multi-level menus

Location:
trunk/src/story_entities
Files:
6 edited

Legend:

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

    r6827 r6835  
    112112
    113113  LoadParam(root, "path", this, GameWorld, setPath)
    114   .describe("The Filename of this GameWorld (relative from the data-dir)");
     114      .describe("The Filename of this GameWorld (relative from the data-dir)");
     115  LoadParam(root, "menu-entry", this, GameWorld, addToGameMenu)
     116      .describe("If this entry is 1, the world is contained in the SimpleGameMenu");
     117
    115118
    116119//   LoadParam(root, "soundtrack", this->dataTank, GameWorldData, setSoundTrack);
  • trunk/src/story_entities/game_world.h

    r6512 r6835  
    5555    void toggleBVVisibility() { this->showBV = !this->showBV; };
    5656
     57    /** toggle the menu visibility: SimpleMenu specific */
     58    inline void addToGameMenu(int toggle) { this->bMenuEntry = (bool)toggle; }
     59    /** @returns true if the GameWorld should be contained in the SimpleMenu: SimpleMenu specific */
     60    inline bool isContainedInMenu() { return this->bMenuEntry; }
     61
    5762
    5863    inline void setSky(WorldEntity* sky) { this->dataTank->sky = sky; }
     
    9398    /* external modules interfaces */
    9499    Shell*              shell;
     100
     101    bool                bMenuEntry;                   //!< If true, this GameWorld apears in the SimpleMenu: SimpleMenu specific
    95102};
    96103
  • trunk/src/story_entities/simple_game_menu.cc

    r6696 r6835  
    5555
    5656  this->cameraVector = Vector(50.0, 0.0, 0.0);
     57  this->menuLayer.push_back(new MenuLayer());
    5758
    5859  this->loadParams(root);
     
    127128    {
    128129      this->menuSelector = dynamic_cast<ImageEntity*>(*entity);
    129       PRINTF(0)("Found the selector: %s\n", (*entity)->getName());
    130130    }
    131131    else if( !strcmp( "StartGame_Menu", (*entity)->getName()))
    132132    {
    133       PRINTF(0)("Found a StartItem: %s\n", (*entity)->getName());
    134133      this->menuStartGame = dynamic_cast<ImageEntity*>(*entity);
    135       this->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
     134      this->menuLayer[0]->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
     135
    136136    }
    137137    else if( !strcmp( "Multiplayer_Menu", (*entity)->getName()))
    138138    {
    139       PRINTF(0)("Found a MultiplayerItem: %s\n", (*entity)->getName());
    140139      this->menuStartMultiplayerGame = dynamic_cast<ImageEntity*>(*entity);
    141       this->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
     140      this->menuLayer[0]->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
    142141    }
    143142    else if( !strcmp( "Quit_Menu", (*entity)->getName()))
    144143    {
    145       PRINTF(0)("Found a QuitItem: %s\n", (*entity)->getName());
    146144      this->menuQuitGame = dynamic_cast<ImageEntity*>(*entity);
    147       this->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
     145      this->menuLayer[0]->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
    148146    }
    149147  }
    150148  this->menuSelectedIndex = 0;
    151   this->menuSelected = this->menuList[this->menuSelectedIndex];
     149  this->menuSelected = this->menuLayer[0]->menuList[this->menuSelectedIndex];
    152150  this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor());
    153151}
     
    233231  {
    234232//     ImageEntity*
    235     if(this->menuSelectedIndex < (this->menuList.size() - 1))
    236     {
    237       this->menuSelected = this->menuList[++this->menuSelectedIndex];
     233    if(this->menuSelectedIndex < (this->menuLayer[0]->menuList.size() - 1))
     234    {
     235      this->menuSelected = this->menuLayer[0]->menuList[++this->menuSelectedIndex];
    238236      this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor());
    239237    }
     
    243241    if(this->menuSelectedIndex > 0)
    244242    {
    245       this->menuSelected = this->menuList[--this->menuSelectedIndex];
     243      this->menuSelected = this->menuLayer[0]->menuList[--this->menuSelectedIndex];
    246244      this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor());
    247245    }
  • trunk/src/story_entities/simple_game_menu.h

    r6696 r6835  
    1818class TiXmlElement;
    1919class ImageEntity;
     20
     21
     22
     23class MenuLayer
     24{
     25  public:
     26    MenuLayer() {}
     27    ~MenuLayer() {}
     28
     29
     30  public:
     31    std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
     32};
     33
    2034
    2135//! a simple game menu based on a story entity
     
    5266
    5367  private:
    54     std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
     68    std::vector<MenuLayer*>           menuLayer;                       //!< the menu layer
     69    MenuLayer*                        selectedLayer;                   //!< the selected menu layer
     70
     71    //std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
    5572    ImageEntity*                      menuSelected;                    //!< ref to the selected menu entity
    5673    ImageEntity*                      menuSelector;                    //!< ref to the selector image
  • trunk/src/story_entities/story_entity.cc

    r6512 r6835  
    6565      .describe("Sets the ID of the next StoryEntity");
    6666
     67  LoadParam(root, "name", this, StoryEntity, setName)
     68      .describe("Sets the name of this StoryEntity");
     69
    6770  PRINTF(4)("Loaded StoryEntity specific stuff\n");
    6871}
  • trunk/src/story_entities/story_entity.h

    r6634 r6835  
    6767  /**  gets the story id of the current entity @returns story id */
    6868  inline int getNextStoryID() { return this->nextStoryID; }
    69 
     69  /** sets the name of this StoryEntity @param name name */
     70  inline void setName(const char* name) { this->name = name; }
     71  /** @returns the name of this StoryEntity */
     72  inline const char* getName() { return this->name; }
    7073
    7174
     
    7982    int storyID;           //!< this is the number of this entity, identifying it in a list/tree...
    8083    int nextStoryID;       //!< if this entity has finished, this entity shall be called
     84    const char* name;      //!< name of this StoryEntity
    8185};
    8286
Note: See TracChangeset for help on using the changeset viewer.