Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6919 was 6874, checked in by patrick, 19 years ago

trunk: the menu control better implemented

File size: 2.9 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
17class SimpleGameMenuData;
18class TiXmlElement;
19class ImageEntity;
20
21
22
23class MenuLayer
24{
25  public:
26    MenuLayer() {}
27    ~MenuLayer() {}
28
29
30  public:
31    std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
32    std::vector<StoryEntity*>         storyList;                       //!< the list of the StoryEntities for the menu
33    std::vector<ImageEntity*>         screenshootList;                 //!< list of the screen shoots FIXME: make a better structure for this stuff
34};
35
36
37//! a simple game menu based on a story entity
38/**
39 * This is a simple menu, that is based on the StoryEntity. Therefore this menu is absolutly
40 * loadable and is exchangeable very easely :D
41 */
42class SimpleGameMenu : virtual public GameWorld, virtual public EventListener
43{
44
45  public:
46    SimpleGameMenu(const TiXmlElement* root = NULL);
47    virtual ~SimpleGameMenu();
48
49    virtual void loadParams(const TiXmlElement* root);
50
51    virtual ErrorMessage init();
52    virtual ErrorMessage loadData();
53    virtual ErrorMessage unloadData();
54
55    virtual bool start();
56    virtual bool stop();
57
58    virtual void process(const Event &event);
59
60
61  protected:
62    virtual void tick();
63    virtual void collide();
64
65
66  private:
67    void animateScene(float dt);
68    void switchMenuLayer(int layer1, int layer2);
69
70
71  private:
72    std::vector<MenuLayer*>           menuLayer;                       //!< the menu layer
73    MenuLayer*                        selectedLayer;                   //!< the selected menu layer
74    int                               layerIndex;
75
76    //std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
77    ImageEntity*                      menuSelected;                    //!< ref to the selected menu entity
78    ImageEntity*                      menuSelector;                    //!< ref to the selector image
79    ImageEntity*                      menuStartGame;
80    ImageEntity*                      menuStartMultiplayerGame;
81    ImageEntity*                      menuQuitGame;
82    int                               menuSelectedIndex;
83
84    Vector                            cameraVector;
85};
86
87
88
89//! the simple game menu data
90class SimpleGameMenuData : public GameWorldData
91{
92
93  public:
94    SimpleGameMenuData();
95    virtual ~SimpleGameMenuData();
96
97    virtual ErrorMessage init();
98
99
100  protected:
101    virtual ErrorMessage loadGUI(TiXmlElement* root);
102    virtual ErrorMessage loadWorldEntities(TiXmlElement* root);
103    virtual ErrorMessage loadScene(TiXmlElement* root);
104
105    virtual ErrorMessage unloadGUI();
106    virtual ErrorMessage unloadWorldEntities();
107    virtual ErrorMessage unloadScene();
108
109};
110
111
112#endif /* _GAME_WORLD_H */
Note: See TracBrowser for help on using the repository browser.