Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/story_entities/simple_game_menu.h @ 7108

Last change on this file since 7108 was 7063, checked in by bensch, 18 years ago

orxonox/trunk: better MenuSelector

File size: 3.0 KB
RevLine 
[6501]1/*!
2 * @file simple_game_menu.h
3 *  a StoryEntity that contains a simple game menu
4 */
5
6#ifndef _SIMPLE_GAME_MENU_H
7#define _SIMPLE_GAME_MENU_H
8
9
[6502]10#include "game_world.h"
[6504]11#include "event_listener.h"
[6502]12#include "game_world_data.h"
[6520]13#include <vector>
[6521]14#include "vector.h"
[6501]15
16
[7019]17#include "elements/text_element.h"
18
[6501]19class SimpleGameMenuData;
[6502]20class TiXmlElement;
[6520]21class ImageEntity;
[6501]22
[6835]23
24
25class MenuLayer
26{
27  public:
28    MenuLayer() {}
[6981]29    virtual ~MenuLayer() {}
[6835]30
31
32  public:
[7019]33    std::vector<TextElement*>          menuList;                        //!< the list of the menu items
[6839]34    std::vector<StoryEntity*>         storyList;                       //!< the list of the StoryEntities for the menu
[6874]35    std::vector<ImageEntity*>         screenshootList;                 //!< list of the screen shoots FIXME: make a better structure for this stuff
[6835]36};
37
38
[6501]39//! a simple game menu based on a story entity
40/**
41 * This is a simple menu, that is based on the StoryEntity. Therefore this menu is absolutly
42 * loadable and is exchangeable very easely :D
43 */
[6504]44class SimpleGameMenu : virtual public GameWorld, virtual public EventListener
[6501]45{
46
47  public:
[6502]48    SimpleGameMenu(const TiXmlElement* root = NULL);
[6501]49    virtual ~SimpleGameMenu();
50
[6696]51    virtual void loadParams(const TiXmlElement* root);
[6501]52
[6504]53    virtual ErrorMessage init();
[6521]54    virtual ErrorMessage loadData();
[6862]55    virtual ErrorMessage unloadData();
[6521]56
[6504]57    virtual bool start();
58    virtual bool stop();
59
60    virtual void process(const Event &event);
61
62
63  protected:
[6521]64    virtual void tick();
[6502]65    virtual void collide();
[6520]66
67
68  private:
[6521]69    void animateScene(float dt);
[6837]70    void switchMenuLayer(int layer1, int layer2);
[7063]71    void sliderTo(const Element2D* element, float bias = 0.0f);
[6521]72
73
74  private:
[6991]75    std::vector<MenuLayer>            menuLayers;                      //!< the menu layer
[6835]76    MenuLayer*                        selectedLayer;                   //!< the selected menu layer
[6837]77    int                               layerIndex;
[6835]78
79    //std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
[6520]80    ImageEntity*                      menuSelector;                    //!< ref to the selector image
[7019]81    TextElement*                      menuSelected;                    //!< ref to the selected menu entity
82    TextElement*                      menuStartGame;
83    TextElement*                      menuStartMultiplayerGame;
84    TextElement*                      menuQuitGame;
[6520]85    int                               menuSelectedIndex;
[6521]86
87    Vector                            cameraVector;
[6502]88};
[6501]89
90
91
[6502]92//! the simple game menu data
93class SimpleGameMenuData : public GameWorldData
94{
[6501]95
[6502]96  public:
97    SimpleGameMenuData();
98    virtual ~SimpleGameMenuData();
[6501]99
[6502]100    virtual ErrorMessage init();
[6501]101
[6502]102
103  protected:
104    virtual ErrorMessage loadGUI(TiXmlElement* root);
105    virtual ErrorMessage loadWorldEntities(TiXmlElement* root);
106    virtual ErrorMessage loadScene(TiXmlElement* root);
107
108    virtual ErrorMessage unloadGUI();
109    virtual ErrorMessage unloadWorldEntities();
110    virtual ErrorMessage unloadScene();
111
[6501]112};
113
114
115#endif /* _GAME_WORLD_H */
Note: See TracBrowser for help on using the repository browser.