Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/cd/src/story_entities/simple_game_menu.h @ 7705

Last change on this file since 7705 was 7318, checked in by bensch, 19 years ago

orxonox/trunk: SoundSource in the Menu

File size: 3.1 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;
22class SoundSource;
23
24
25
26class MenuLayer
27{
28  public:
29    MenuLayer() {}
30    virtual ~MenuLayer() {}
31
32
33  public:
34    std::vector<TextElement*>          menuList;                        //!< the list of the menu items
35    std::vector<StoryEntity*>         storyList;                       //!< the list of the StoryEntities for the menu
36    std::vector<ImageEntity*>         screenshootList;                 //!< list of the screen shoots FIXME: make a better structure for this stuff
37};
38
39
40//! a simple game menu based on a story entity
41/**
42 * This is a simple menu, that is based on the StoryEntity. Therefore this menu is absolutly
43 * loadable and is exchangeable very easely :D
44 */
45class SimpleGameMenu : virtual public GameWorld, virtual public EventListener
46{
47
48  public:
49    SimpleGameMenu(const TiXmlElement* root = NULL);
50    virtual ~SimpleGameMenu();
51
52    virtual void loadParams(const TiXmlElement* root);
53
54    virtual ErrorMessage init();
55    virtual ErrorMessage loadData();
56    virtual ErrorMessage unloadData();
57
58    virtual bool start();
59    virtual bool stop();
60
61    virtual void process(const Event &event);
62
63
64  protected:
65    virtual void tick();
66    virtual void collide();
67
68
69  private:
70    void animateScene(float dt);
71    void switchMenuLayer(int layer1, int layer2);
72    void sliderTo(const Element2D* element, float bias = 0.0f);
73    void setSelectorSound(const std::string& selectorSound);
74
75
76  private:
77    std::vector<MenuLayer>            menuLayers;                      //!< the menu layer
78    MenuLayer*                        selectedLayer;                   //!< the selected menu layer
79    int                               layerIndex;
80
81    //std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
82    ImageEntity*                      menuSelector;                    //!< ref to the selector image
83    TextElement*                      menuSelected;                    //!< ref to the selected menu entity
84    TextElement*                      menuStartGame;
85    TextElement*                      menuStartMultiplayerGame;
86    TextElement*                      menuQuitGame;
87    int                               menuSelectedIndex;
88
89    Vector                            cameraVector;
90
91    SoundSource*                      selectorSource;
92};
93
94
95
96//! the simple game menu data
97class SimpleGameMenuData : public GameWorldData
98{
99
100  public:
101    SimpleGameMenuData();
102    virtual ~SimpleGameMenuData();
103
104    virtual ErrorMessage init();
105
106
107  protected:
108    virtual ErrorMessage loadGUI(TiXmlElement* root);
109    virtual ErrorMessage loadWorldEntities(TiXmlElement* root);
110    virtual ErrorMessage loadScene(TiXmlElement* root);
111
112    virtual ErrorMessage unloadGUI();
113    virtual ErrorMessage unloadWorldEntities();
114    virtual ErrorMessage unloadScene();
115
116};
117
118
119#endif /* _GAME_WORLD_H */
Note: See TracBrowser for help on using the repository browser.