Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/water/src/story_entities/game_world.h @ 8233

Last change on this file since 8233 was 8089, checked in by stefalie, 19 years ago

water: gui hack

File size: 3.8 KB
Line 
1/*!
2 * @file game_world.h
3 *  container for all game worlds (singleplayers, multiplayers..)
4 */
5
6#ifndef _GAME_WORLD_H
7#define _GAME_WORLD_H
8
9
10#include "story_entity.h"
11#include "game_world_data.h"
12#include "playable.h"
13
14#include "glgui.h"
15
16namespace OrxShell { class Shell; };
17class WorldEntity;
18class GameRules;
19
20/** How many frames time values to keep
21 * The higher the value the smoother the result is...
22 * Don't make it 0 or less :)
23 */
24#define TICK_SMOOTH_VALUE 10
25
26//! The game world
27/**
28 *  this class initializes everything that should be displayed inside of the current level.
29 *  it is the main driving factor during gameplay.
30 */
31class GameWorld : public StoryEntity
32{
33  public:
34    GameWorld ();
35    virtual ~GameWorld ();
36
37//// HACK NOT TO THE TRUNK //
38    void enterGui();
39    void setImage(int i);
40    int getImage(const std::string& name);
41    OrxGui::GLGuiImage* image;
42    OrxGui::GLGuiInputLine* imageName;
43/////////////////////////////
44
45    virtual void loadParams(const TiXmlElement* root);
46
47    /* functions from story-entity */
48    virtual ErrorMessage init();
49    virtual ErrorMessage loadData();
50    virtual ErrorMessage unloadData();
51
52    virtual bool start();
53    virtual bool stop();
54    virtual bool pause();
55    virtual bool resume();
56    virtual void run();
57
58    void setPlaymode(Playable::Playmode playmode);
59    void setPlaymode(const std::string& playmode);
60    /**  this returns the current game time @returns elapsed game time     */
61    inline double getGameTime() { return this->gameTime; }
62    /** sets the game speed @param speed speed of the Game */
63    inline void setSpeed(float speed) { this->speed = speed; };
64    /**  returns the track path of this world @returns the track path */
65
66    void togglePNodeVisibility();
67    void toggleBVVisibility(int level);
68
69    inline void setSky(WorldEntity* sky) { this->dataTank->sky = sky; }
70
71
72  protected:
73    /* world - running functions */
74    virtual void synchronize();
75    virtual void handleInput();
76    virtual void tick(ObjectManager::EntityList worldEntity, float dt);
77    virtual void tick();
78    virtual void update();
79    virtual void checkGameRules();
80    virtual void collide();
81
82    void drawEntityList(const ObjectManager::EntityList& drawList ) const;
83    virtual void renderPassReflection();
84    virtual void renderPassRefraction();
85    virtual void renderPassAll();
86
87
88    virtual void display();
89
90
91  private:
92    void displayLoadScreen();
93    void releaseLoadScreen();
94
95
96  protected:
97    GameWorldData*      dataTank;                     //!< reference to the GameWorld Data Tank
98    TiXmlElement*       dataXML;                      //!< The XML-Element this World has been loaded with.
99
100    bool                showPNodes;                   //!< if the PNodes should be visible.
101    bool                showBV;                       //!< if the Bounding Volumes should be visible.
102    int                 showBVLevel;                  //!< the depth level of the displayed bounding volumes
103
104    /* world timing */
105    double              lastFrame;                    //!< last time of frame (in MiliSeconds)
106    Uint32              cycle;                        //!< The cycle we are in (starts with 0 and rises with every frame)
107    float               dtS;                          //!< The time needed for caluculations in seconds
108    float               speed;                        //!< how fast the game flows
109    double              gameTime;                     //!< this is where the game time is saved
110    double              frameTimes[TICK_SMOOTH_VALUE];//!< The time used for the last TICK_SMOOTH_VALUE's frames.
111
112    GameRules*          gameRules;                    //!< Pointer to the data structure containig the game rules
113
114
115  private:
116    /* external modules interfaces */
117    OrxShell::Shell*    shell;
118};
119
120#endif /* _GAME_WORLD_H */
Note: See TracBrowser for help on using the repository browser.