[6501] | 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 | |
---|
[6502] | 10 | #include "game_world.h" |
---|
[6504] | 11 | #include "event_listener.h" |
---|
[6502] | 12 | #include "game_world_data.h" |
---|
[6520] | 13 | #include <vector> |
---|
[6521] | 14 | #include "vector.h" |
---|
[6501] | 15 | |
---|
| 16 | |
---|
[7019] | 17 | #include "elements/text_element.h" |
---|
| 18 | |
---|
[6501] | 19 | class SimpleGameMenuData; |
---|
[6502] | 20 | class TiXmlElement; |
---|
[6520] | 21 | class ImageEntity; |
---|
[6501] | 22 | |
---|
[7460] | 23 | namespace OrxSound { class SoundSource; } |
---|
[6835] | 24 | |
---|
| 25 | class MenuLayer |
---|
| 26 | { |
---|
| 27 | public: |
---|
| 28 | MenuLayer() {} |
---|
[6981] | 29 | virtual ~MenuLayer() {} |
---|
[6835] | 30 | |
---|
| 31 | |
---|
| 32 | public: |
---|
[7019] | 33 | std::vector<TextElement*> menuList; //!< the list of the menu items |
---|
[6839] | 34 | std::vector<StoryEntity*> storyList; //!< the list of the StoryEntities for the menu |
---|
[6874] | 35 | std::vector<ImageEntity*> screenshootList; //!< list of the screen shoots FIXME: make a better structure for this stuff |
---|
[6835] | 36 | }; |
---|
| 37 | |
---|
| 38 | |
---|
[6501] | 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 | */ |
---|
[6504] | 44 | class SimpleGameMenu : virtual public GameWorld, virtual public EventListener |
---|
[6501] | 45 | { |
---|
| 46 | |
---|
| 47 | public: |
---|
[6502] | 48 | SimpleGameMenu(const TiXmlElement* root = NULL); |
---|
[6501] | 49 | virtual ~SimpleGameMenu(); |
---|
| 50 | |
---|
[7919] | 51 | /// TODO TAKE THIS OUT |
---|
| 52 | void enterGui(); |
---|
| 53 | void execURL() const; |
---|
| 54 | static int startURL(void* data); |
---|
| 55 | /// |
---|
[6696] | 56 | virtual void loadParams(const TiXmlElement* root); |
---|
[6501] | 57 | |
---|
[6504] | 58 | virtual ErrorMessage init(); |
---|
[6521] | 59 | virtual ErrorMessage loadData(); |
---|
[6862] | 60 | virtual ErrorMessage unloadData(); |
---|
[6521] | 61 | |
---|
[6504] | 62 | virtual bool start(); |
---|
| 63 | virtual bool stop(); |
---|
| 64 | |
---|
| 65 | virtual void process(const Event &event); |
---|
| 66 | |
---|
| 67 | |
---|
[7919] | 68 | void startLevel(int level); |
---|
| 69 | void quitMenu(); |
---|
| 70 | |
---|
| 71 | void TEST() { printf("TEST\n"); } |
---|
| 72 | |
---|
[6504] | 73 | protected: |
---|
[6521] | 74 | virtual void tick(); |
---|
[6502] | 75 | virtual void collide(); |
---|
[6520] | 76 | |
---|
| 77 | |
---|
| 78 | private: |
---|
[6521] | 79 | void animateScene(float dt); |
---|
[6837] | 80 | void switchMenuLayer(int layer1, int layer2); |
---|
[7063] | 81 | void sliderTo(const Element2D* element, float bias = 0.0f); |
---|
[7318] | 82 | void setSelectorSound(const std::string& selectorSound); |
---|
[6521] | 83 | |
---|
| 84 | |
---|
| 85 | private: |
---|
[6991] | 86 | std::vector<MenuLayer> menuLayers; //!< the menu layer |
---|
[6835] | 87 | MenuLayer* selectedLayer; //!< the selected menu layer |
---|
[6837] | 88 | int layerIndex; |
---|
[6835] | 89 | |
---|
| 90 | //std::vector<ImageEntity*> menuList; //!< the list of the menu items |
---|
[6520] | 91 | ImageEntity* menuSelector; //!< ref to the selector image |
---|
[7019] | 92 | TextElement* menuSelected; //!< ref to the selected menu entity |
---|
| 93 | TextElement* menuStartGame; |
---|
| 94 | TextElement* menuStartMultiplayerGame; |
---|
| 95 | TextElement* menuQuitGame; |
---|
[6520] | 96 | int menuSelectedIndex; |
---|
[6521] | 97 | |
---|
| 98 | Vector cameraVector; |
---|
[7318] | 99 | |
---|
[7460] | 100 | OrxSound::SoundSource* selectorSource; |
---|
[6502] | 101 | }; |
---|
[6501] | 102 | |
---|
| 103 | |
---|
| 104 | |
---|
[6502] | 105 | //! the simple game menu data |
---|
| 106 | class SimpleGameMenuData : public GameWorldData |
---|
| 107 | { |
---|
[6501] | 108 | |
---|
[6502] | 109 | public: |
---|
| 110 | SimpleGameMenuData(); |
---|
| 111 | virtual ~SimpleGameMenuData(); |
---|
[6501] | 112 | |
---|
[6502] | 113 | virtual ErrorMessage init(); |
---|
[6501] | 114 | |
---|
[6502] | 115 | |
---|
| 116 | protected: |
---|
[7370] | 117 | virtual ErrorMessage loadGUI(const TiXmlElement* root); |
---|
| 118 | virtual ErrorMessage loadWorldEntities(const TiXmlElement* root); |
---|
| 119 | virtual ErrorMessage loadScene(const TiXmlElement* root); |
---|
[6502] | 120 | |
---|
| 121 | virtual ErrorMessage unloadGUI(); |
---|
| 122 | virtual ErrorMessage unloadWorldEntities(); |
---|
| 123 | virtual ErrorMessage unloadScene(); |
---|
| 124 | |
---|
[6501] | 125 | }; |
---|
| 126 | |
---|
| 127 | |
---|
| 128 | #endif /* _GAME_WORLD_H */ |
---|