Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: drawLists/tickLists are used, and made some TiXmlElement to const TiXmlElement, also fixed some bugs in the loadWorldEntities-functions from Gameworld and SipleGameMenu

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