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