1 | /*! |
---|
2 | * @file game_menu.h |
---|
3 | * a StoryEntity that contains a simple game menu |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _GAME_MENU_H |
---|
7 | #define _GAME_MENU_H |
---|
8 | |
---|
9 | |
---|
10 | #include "game_world.h" |
---|
11 | #include "game_world_data.h" |
---|
12 | #include <vector> |
---|
13 | #include "glgui.h" |
---|
14 | |
---|
15 | namespace OrxSound { class SoundSource; } |
---|
16 | |
---|
17 | //! a simple game menu based on a story entity |
---|
18 | /** |
---|
19 | * This is a simple menu, that is based on the StoryEntity. Therefore this menu is absolutly |
---|
20 | * loadable and is exchangeable very easely :D |
---|
21 | */ |
---|
22 | class GameMenu : virtual public GameWorld, virtual public EventListener |
---|
23 | { |
---|
24 | ObjectListDeclaration(GameMenu); |
---|
25 | public: |
---|
26 | GameMenu(const TiXmlElement* root = NULL); |
---|
27 | virtual ~GameMenu(); |
---|
28 | |
---|
29 | virtual void loadParams(const TiXmlElement* root); |
---|
30 | |
---|
31 | virtual ErrorMessage init(); |
---|
32 | virtual ErrorMessage loadData(); |
---|
33 | virtual ErrorMessage unloadData(); |
---|
34 | |
---|
35 | virtual bool start(); |
---|
36 | virtual bool stop(); |
---|
37 | |
---|
38 | virtual void process(const Event &event); |
---|
39 | |
---|
40 | |
---|
41 | void startLevel(int level); |
---|
42 | |
---|
43 | void showMainMenu(); |
---|
44 | void showCampaigns(); |
---|
45 | void showMultiPlayer(); |
---|
46 | void showOptionsMenu(); |
---|
47 | |
---|
48 | void showClientMenu(); |
---|
49 | void connectToServer(); |
---|
50 | |
---|
51 | void showServerMenu(); |
---|
52 | void createMasterServer(); |
---|
53 | |
---|
54 | |
---|
55 | void quitMenu(); |
---|
56 | |
---|
57 | protected: |
---|
58 | virtual void tick(); |
---|
59 | virtual void collide(); |
---|
60 | |
---|
61 | |
---|
62 | private: |
---|
63 | void showSecondLevelElement(OrxGui::GLGuiBox* element); |
---|
64 | |
---|
65 | |
---|
66 | void animateScene(float dt); |
---|
67 | void switchMenuLayer(int layer1, int layer2); |
---|
68 | void sliderTo(const Element2D* element, float bias = 0.0f); |
---|
69 | void setSelectorSound(const std::string& selectorSound); |
---|
70 | |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | private: |
---|
75 | OrxGui::GLGuiBox* mainMenuBox; |
---|
76 | OrxGui::GLGuiBox* levelsBox; |
---|
77 | OrxGui::GLGuiBox* networkBox; |
---|
78 | |
---|
79 | OrxGui::GLGuiBox* clientNetworkBox; |
---|
80 | OrxGui::GLGuiInputLine* ipInputLine; |
---|
81 | |
---|
82 | OrxGui::GLGuiBox* serverNetworkBox; |
---|
83 | |
---|
84 | OrxGui::GLGuiBox* optionsBox; |
---|
85 | OrxGui::GLGuiBox* generalBox; |
---|
86 | OrxGui::GLGuiBox* audioBox; |
---|
87 | OrxGui::GLGuiBox* videoBox; |
---|
88 | OrxGui::GLGuiBox* controlBox; |
---|
89 | |
---|
90 | OrxGui::GLGuiBox* currentlyOpened; |
---|
91 | |
---|
92 | Vector cameraVector; |
---|
93 | |
---|
94 | OrxSound::SoundSource* selectorSource; |
---|
95 | }; |
---|
96 | |
---|
97 | |
---|
98 | |
---|
99 | //! the simple game menu data |
---|
100 | class GameMenuData : public GameWorldData |
---|
101 | { |
---|
102 | |
---|
103 | public: |
---|
104 | GameMenuData(); |
---|
105 | virtual ~GameMenuData(); |
---|
106 | |
---|
107 | virtual ErrorMessage init(); |
---|
108 | |
---|
109 | |
---|
110 | protected: |
---|
111 | virtual ErrorMessage loadGUI(const TiXmlElement* root); |
---|
112 | virtual ErrorMessage loadWorldEntities(const TiXmlElement* root); |
---|
113 | virtual ErrorMessage loadScene(const TiXmlElement* root); |
---|
114 | |
---|
115 | virtual ErrorMessage unloadGUI(); |
---|
116 | virtual ErrorMessage unloadWorldEntities(); |
---|
117 | virtual ErrorMessage unloadScene(); |
---|
118 | |
---|
119 | }; |
---|
120 | |
---|
121 | |
---|
122 | #endif /* _GAME_WORLD_H */ |
---|