Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/multitexture/src/story_entities/game_world.h @ 7378

Last change on this file since 7378 was 7374, checked in by bensch, 19 years ago

orxonox/trunk: added new Files shell_completion_plugin for the new Plugin Structure.
Also created the first namespace: OrxShell

File size: 3.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
10#include "story_entity.h"
11#include "game_world_data.h"
12#include "playable.h"
13
14class OrxShell::Shell;
15class WorldEntity;
16
17/** How many frames time values to keep
18 * The higher the value the smoother the result is...
19 * Don't make it 0 or less :)
20 */
21#define TICK_SMOOTH_VALUE 10
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  public:
31    GameWorld ();
32    virtual ~GameWorld ();
33
34    virtual void loadParams(const TiXmlElement* root);
35
36    /* functions from story-entity */
37    virtual ErrorMessage init();
38    virtual ErrorMessage loadData();
39    virtual ErrorMessage unloadData();
40
41    virtual bool start();
42    virtual bool stop();
43    virtual bool pause();
44    virtual bool resume();
45    virtual void run();
46
47    void setPlaymode(Playable::Playmode playmode);
48    void setPlaymode(const std::string& playmode);
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
55    static void togglePNodeVisibility();
56    static void toggleBVVisibility();
57
58    inline void setSky(WorldEntity* sky) { this->dataTank->sky = sky; }
59
60
61  protected:
62    /* world - running functions */
63    virtual void synchronize();
64    virtual void handleInput();
65    virtual void tick(ObjectManager::EntityList worldEntity, float dt);
66    virtual void tick();
67    virtual void update();
68    virtual void collide();
69
70    void drawEntityList(const ObjectManager::EntityList& drawList ) const;
71    virtual void draw();
72    virtual void display();
73
74
75  private:
76    void displayLoadScreen();
77    void releaseLoadScreen();
78
79
80  protected:
81    GameWorldData*      dataTank;                     //!< reference to the GameWorld Data Tank
82    TiXmlElement*       dataXML;                      //!< The XML-Element this World has been loaded with.
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 (in MiliSeconds)
89    Uint32              cycle;                        //!< The cycle we are in (starts with 0 and rises with every frame)
90    float               dtS;                          //!< The time needed for caluculations in seconds
91    float               speed;                        //!< how fast the game flows
92    double              gameTime;                     //!< this is where the game time is saved
93    Uint32              frameTimes[TICK_SMOOTH_VALUE];//!< The time used for the last TICK_SMOOTH_VALUE's frames.
94
95
96  private:
97    /* external modules interfaces */
98    OrxShell::Shell*    shell;
99};
100
101#endif /* _GAME_WORLD_H */
Note: See TracBrowser for help on using the repository browser.