Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/cr/src/story_entities/simple_game_menu.h @ 8129

Last change on this file since 8129 was 7919, checked in by bensch, 19 years ago

orxonox/trunk: merged the gui branche back
merged with command:
https://svn.orxonox.net/orxonox/branches/gui
no conflicts

File size: 3.4 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    /// TODO TAKE THIS OUT
52    void enterGui();
53    void execURL() const;
54    static int startURL(void* data);
55    ///
56    virtual void loadParams(const TiXmlElement* root);
57
58    virtual ErrorMessage init();
59    virtual ErrorMessage loadData();
60    virtual ErrorMessage unloadData();
61
62    virtual bool start();
63    virtual bool stop();
64
65    virtual void process(const Event &event);
66
67
68    void startLevel(int level);
69    void quitMenu();
70
71    void TEST() { printf("TEST\n"); }
72
73  protected:
74    virtual void tick();
75    virtual void collide();
76
77
78  private:
79    void animateScene(float dt);
80    void switchMenuLayer(int layer1, int layer2);
81    void sliderTo(const Element2D* element, float bias = 0.0f);
82    void setSelectorSound(const std::string& selectorSound);
83
84
85  private:
86    std::vector<MenuLayer>            menuLayers;                      //!< the menu layer
87    MenuLayer*                        selectedLayer;                   //!< the selected menu layer
88    int                               layerIndex;
89
90    //std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
91    ImageEntity*                      menuSelector;                    //!< ref to the selector image
92    TextElement*                      menuSelected;                    //!< ref to the selected menu entity
93    TextElement*                      menuStartGame;
94    TextElement*                      menuStartMultiplayerGame;
95    TextElement*                      menuQuitGame;
96    int                               menuSelectedIndex;
97
98    Vector                            cameraVector;
99
100    OrxSound::SoundSource*            selectorSource;
101};
102
103
104
105//! the simple game menu data
106class SimpleGameMenuData : public GameWorldData
107{
108
109  public:
110    SimpleGameMenuData();
111    virtual ~SimpleGameMenuData();
112
113    virtual ErrorMessage init();
114
115
116  protected:
117    virtual ErrorMessage loadGUI(const TiXmlElement* root);
118    virtual ErrorMessage loadWorldEntities(const TiXmlElement* root);
119    virtual ErrorMessage loadScene(const TiXmlElement* root);
120
121    virtual ErrorMessage unloadGUI();
122    virtual ErrorMessage unloadWorldEntities();
123    virtual ErrorMessage unloadScene();
124
125};
126
127
128#endif /* _GAME_WORLD_H */
Note: See TracBrowser for help on using the repository browser.