Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/current_cd/src/story_entities/game_world.h @ 6919

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

cd: less debug output, more debug functionality

File size: 3.4 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 "state.h"
12#include "game_world_data.h"
13
14class TiXmlElement;
15class Shell;
16class WorldEntity;
17class GameWorldData;
18
19
20//! The game world
21/**
22 *  this class initializes everything that should be displayed inside of the current level.
23 *  it is the main driving factor during gameplay.
24 */
25class GameWorld : public StoryEntity
26{
27
28  public:
29    GameWorld (const TiXmlElement* root = NULL);
30    virtual ~GameWorld ();
31
32    virtual void loadParams(const TiXmlElement* root);
33
34    /* functions from story-entity */
35    virtual ErrorMessage init();
36    virtual ErrorMessage loadData();
37    virtual ErrorMessage unloadData();
38
39    virtual bool start();
40    virtual bool stop();
41    virtual bool pause();
42    virtual bool resume();
43    virtual void run();
44
45    /**  this returns the current game time @returns elapsed game time     */
46    inline double getGameTime() { return this->gameTime; }
47    /** sets the game speed @param speed speed of the Game */
48    inline void setSpeed(float speed) { this->speed = speed; };
49    /**  returns the track path of this world @returns the track path */
50    const char* getPath() { return this->path; }
51    void setPath( const char* name);
52
53    /** toggles the PNode visibility in the world (drawn as boxes) */
54    void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
55    /** toggles the bounding volume (BV) visibility */
56    void toggleBVVisibility() { dynamic_cast<GameWorld*>(State::getCurrentStoryEntity())->applyToggleBVVisibility(); }
57    void applyToggleBVVisibility() { this->showBV = !this->showBV; }
58
59
60
61    inline void setSky(WorldEntity* sky) { this->dataTank->sky = sky; }
62
63
64  protected:
65    /* world - running functions */
66    virtual void synchronize();
67    virtual void handleInput();
68    virtual void tick(std::list<WorldEntity*> worldEntity, float dt);
69    virtual void tick();
70    virtual void update();
71    virtual void collide();
72    virtual void draw();
73    virtual void display();
74
75
76  private:
77    void displayLoadScreen();
78    void releaseLoadScreen();
79
80
81  protected:
82    GameWorldData*      dataTank;                     //!< reference to the GameWorld Data Tank
83    TiXmlElement*       dataXML;                      //!< The XML-Element this World has been loaded with.
84    char*               path;                         //!< The file from which this world is loaded
85
86    bool                showPNodes;                   //!< if the PNodes should be visible.
87    bool                showBV;                       //!< if the Bounding Volumes should be visible.
88
89    /* world timing */
90    Uint32              lastFrame;                    //!< last time of frame
91    Uint32              cycle;                        //!< The cycle we are in (starts with 0 and rises with every frame)
92    Uint32              dt;                           //!< time needed to calculate this frame (in milliSeconds)
93    float               dtS;                          //!< The time needed for caluculations in seconds
94    float               speed;                        //!< how fast the game flows
95    double              gameTime;                     //!< this is where the game time is saved
96
97    /* external modules interfaces */
98    Shell*              shell;
99};
100
101#endif /* _GAME_WORLD_H */
Note: See TracBrowser for help on using the repository browser.