Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/story_entities/game_world.h @ 6366

Last change on this file since 6366 was 6366, checked in by patrick, 18 years ago

network: inlined some functions

File size: 3.9 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#include "sdlincl.h"
10#include "story_entity.h"
11#include "object_manager.h"
12
13class WorldEntity;
14class Camera;
15class Player;
16class GLMenuImageScreen;
17class Terrain;
18class TiXmlElement;
19
20class Shell;
21class OggPlayer;
22
23//! The game world
24/**
25 *  this class initializes everything that should be displayed inside of the current level.
26 *  it is the main driving factor during gameplay.
27 */
28class GameWorld : public StoryEntity
29{
30
31  public:
32    GameWorld (const TiXmlElement* root = NULL);
33    virtual ~GameWorld ();
34
35    void loadParams(const TiXmlElement* root);
36
37
38    /* classes from story-entity */
39    virtual ErrorMessage preLoad();
40    virtual ErrorMessage load ();
41    virtual ErrorMessage postLoad();
42
43    virtual ErrorMessage preStart();
44    virtual ErrorMessage start ();
45    virtual ErrorMessage stop ();
46    virtual ErrorMessage pause ();
47    virtual ErrorMessage resume ();
48    virtual ErrorMessage destroy ();
49
50    virtual void displayLoadScreen();
51    virtual void releaseLoadScreen();
52
53    /* interface to the game world */
54    virtual void spawn (WorldEntity* entity);
55
56
57    /**  this returns the current game time @returns elapsed game time     */
58    inline double getGameTime() { return this->gameTime; }
59    /** sets the game speed @param speed speed of the Game */
60    inline void setSpeed(float speed) { this->speed = speed; };
61    /**  returns the track path of this world @returns the track path */
62    const char* getPath() {   return path; }
63    void setPath( const char* name);
64
65    /** toggles the PNode visibility in the world (drawn as boxes) */
66    void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
67    /** toggles the bounding volume (BV) visibility */
68    void toggleBVVisibility() { this->showBV = !this->showBV; };
69
70
71  protected:
72    virtual void constuctorInit(const char* name, int worldID);
73
74    /* world - running functions */
75    virtual void mainLoop ();
76
77    virtual void synchronize ();
78    virtual void handleInput ();
79    virtual void tick (std::list<WorldEntity*> worldEntity, float dt);
80    virtual void tick ();
81    virtual void update ();
82    virtual void collide ();
83    virtual void draw ();
84    virtual void display ();
85
86
87  protected:
88    char* path;                         //!< The file from which this world is loaded
89
90    /* state flags */
91    bool bQuitWorld;                    //!< quit only the current game and return to menu
92    bool bPause;                        //!< pause mode
93
94    bool showPNodes;                    //!< if the PNodes should be visible.
95    bool showBV;                        //!< if the Bounding Volumes should be visible.
96
97    GLMenuImageScreen* glmis;           //!< The Level-Loader Display
98
99    /* world timing */
100    Uint32 lastFrame;                   //!< last time of frame
101    Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
102    Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
103    float dtS;                          //!< The time needed for caluculations in seconds
104    float speed;                        //!< how fast the game flows
105    double gameTime;                    //!< this is where the game time is saved
106
107    /* external modules interfaces */
108    ObjectManager objectManager;        //!< The ObjectManager of this GameWorld.
109
110    /* external modules interfaces */
111    Shell*     shell;
112    OggPlayer* music;
113
114    /* important entities */
115    Camera* localCamera;                //!< The current Camera
116    Player* localPlayer;                //!< The Player, you fly through the level.
117    WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
118    Terrain* terrain;                   //!< The Terrain of the GameWorld.
119
120};
121
122#endif /* _GAME_WORLD_H */
Note: See TracBrowser for help on using the repository browser.