Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/gui/src/story_entities/simple_game_menu.h @ 8141

Last change on this file since 8141 was 8035, checked in by bensch, 19 years ago

gui: merged the gui back to the trunk

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