Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

network: much more work on the StoryEntity functions and reimplementations of the DataTanks of each StoryEntity

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