Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7741 was 7460, checked in by bensch, 19 years ago

orxonox/trunk: Namespaces for sound

File size: 3.2 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
23namespace OrxSound { class SoundSource; }
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    void setSelectorSound(const std::string& selectorSound);
73
74
75  private:
76    std::vector<MenuLayer>            menuLayers;                      //!< the menu layer
77    MenuLayer*                        selectedLayer;                   //!< the selected menu layer
78    int                               layerIndex;
79
80    //std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
81    ImageEntity*                      menuSelector;                    //!< ref to the selector image
82    TextElement*                      menuSelected;                    //!< ref to the selected menu entity
83    TextElement*                      menuStartGame;
84    TextElement*                      menuStartMultiplayerGame;
85    TextElement*                      menuQuitGame;
86    int                               menuSelectedIndex;
87
88    Vector                            cameraVector;
89
90    OrxSound::SoundSource*            selectorSource;
91};
92
93
94
95//! the simple game menu data
96class SimpleGameMenuData : public GameWorldData
97{
98
99  public:
100    SimpleGameMenuData();
101    virtual ~SimpleGameMenuData();
102
103    virtual ErrorMessage init();
104
105
106  protected:
107    virtual ErrorMessage loadGUI(const TiXmlElement* root);
108    virtual ErrorMessage loadWorldEntities(const TiXmlElement* root);
109    virtual ErrorMessage loadScene(const TiXmlElement* root);
110
111    virtual ErrorMessage unloadGUI();
112    virtual ErrorMessage unloadWorldEntities();
113    virtual ErrorMessage unloadScene();
114
115};
116
117
118#endif /* _GAME_WORLD_H */
Note: See TracBrowser for help on using the repository browser.