Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7905 was 7884, checked in by bensch, 19 years ago

orxonox/trunk: first Event gets dispached… but i see, that the interface is crappy… there has to be a much better solution for:

  1. Generating Signals (more variable)
  2. Bringing Variables onto the Signals
  3. Interface has to be way simpler:

at the moment the Interface looks like this:
===
OrxGui::GLGuiPushButton* rdnpb = new OrxGui::GLGuiPushButton("REALLY DO NOT PUSH ME");
rdnpb→connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::quitMenu));
===
But it should be like the following:
OrxGui::GLGuiPushButton* pb = new OrxGui::GLGuiPushButton("Push this button, it is way better");
pb→connect(this, OrxGui::SIGNAL(released()), this, OrxGui::SLOT(quitMenu()));

man, this would be almost too much :)

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