Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/control/src/story_entities/simple_game_menu.h @ 7231

Last change on this file since 7231 was 7063, checked in by bensch, 19 years ago

orxonox/trunk: better MenuSelector

File size: 3.0 KB
Line 
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
10#include "game_world.h"
11#include "event_listener.h"
12#include "game_world_data.h"
13#include <vector>
14#include "vector.h"
15
16
17#include "elements/text_element.h"
18
19class SimpleGameMenuData;
20class TiXmlElement;
21class ImageEntity;
22
23
24
25class MenuLayer
26{
27  public:
28    MenuLayer() {}
29    virtual ~MenuLayer() {}
30
31
32  public:
33    std::vector<TextElement*>          menuList;                        //!< the list of the menu items
34    std::vector<StoryEntity*>         storyList;                       //!< the list of the StoryEntities for the menu
35    std::vector<ImageEntity*>         screenshootList;                 //!< list of the screen shoots FIXME: make a better structure for this stuff
36};
37
38
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 */
44class SimpleGameMenu : virtual public GameWorld, virtual public EventListener
45{
46
47  public:
48    SimpleGameMenu(const TiXmlElement* root = NULL);
49    virtual ~SimpleGameMenu();
50
51    virtual void loadParams(const TiXmlElement* root);
52
53    virtual ErrorMessage init();
54    virtual ErrorMessage loadData();
55    virtual ErrorMessage unloadData();
56
57    virtual bool start();
58    virtual bool stop();
59
60    virtual void process(const Event &event);
61
62
63  protected:
64    virtual void tick();
65    virtual void collide();
66
67
68  private:
69    void animateScene(float dt);
70    void switchMenuLayer(int layer1, int layer2);
71    void sliderTo(const Element2D* element, float bias = 0.0f);
72
73
74  private:
75    std::vector<MenuLayer>            menuLayers;                      //!< the menu layer
76    MenuLayer*                        selectedLayer;                   //!< the selected menu layer
77    int                               layerIndex;
78
79    //std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
80    ImageEntity*                      menuSelector;                    //!< ref to the selector image
81    TextElement*                      menuSelected;                    //!< ref to the selected menu entity
82    TextElement*                      menuStartGame;
83    TextElement*                      menuStartMultiplayerGame;
84    TextElement*                      menuQuitGame;
85    int                               menuSelectedIndex;
86
87    Vector                            cameraVector;
88};
89
90
91
92//! the simple game menu data
93class SimpleGameMenuData : public GameWorldData
94{
95
96  public:
97    SimpleGameMenuData();
98    virtual ~SimpleGameMenuData();
99
100    virtual ErrorMessage init();
101
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
112};
113
114
115#endif /* _GAME_WORLD_H */
Note: See TracBrowser for help on using the repository browser.