Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7019 was 7019, checked in by bensch, 18 years ago

orxonox/trunk: Using TextEngine in the Menu

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