Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/story_entities/world.h @ 6151

Last change on this file since 6151 was 6151, checked in by bensch, 18 years ago

trunk: more world cleanup

File size: 3.2 KB
Line 
1/*!
2 * @file world.h
3  *  Holds and manages all game data
4*/
5
6#ifndef _WORLD_H
7#define _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 World : public StoryEntity {
29
30 public:
31  World (const TiXmlElement* root = NULL);
32  virtual ~World ();
33
34  void loadParams(const TiXmlElement* root);
35
36  double getGameTime();
37
38  /* classes from story-entity */
39  virtual ErrorMessage preLoad();
40  virtual ErrorMessage load ();
41  virtual ErrorMessage init ();
42  virtual ErrorMessage start ();
43  virtual ErrorMessage stop ();
44  virtual ErrorMessage pause ();
45  virtual ErrorMessage resume ();
46  virtual ErrorMessage destroy ();
47
48  virtual void displayLoadScreen();
49  virtual void releaseLoadScreen();
50
51  /* interface to world */
52  void spawn (WorldEntity* entity);
53
54  /** @param speed sets the speed of the Game */
55  inline void setSpeed(float speed) { this->speed = speed; };
56  const char* getPath();
57  void setPath( const char* name);
58
59  void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
60  void toggleBVVisibility() { this->showBV = !this->showBV; };
61
62 private:
63  void constuctorInit(const char* name, int worldID);
64  /* function for main-loop */
65  void synchronize ();
66  void handleInput ();
67  void tick (std::list<WorldEntity*> worldEntity, float dt);
68  void tick ();
69  void update ();
70  void collide ();
71  void draw ();
72  void mainLoop ();
73
74  void display ();
75  void debug ();
76
77  private:
78    char* path;                         //!< The file from which this world is loaded
79
80    // FLAGS //
81    bool bQuitWorld;                    //!< quit only the current game and return to menu
82    bool bPause;                        //!< pause mode
83
84    bool showPNodes;                    //!< if the PNodes should be visible.
85    bool showBV;                        //!< if the Bounding Volumes should be visible.
86
87    // 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    // INTERNAL ENGINES
96    ObjectManager objectManager;        //!< The ObjectManager of this World.
97    Shell*     shell;
98    OggPlayer* music;
99
100    GLMenuImageScreen* glmis;           //!< The Level-Loader Display
101
102
103    // IMPORTANT ENTITIES
104    Camera* localCamera;                //!< The current Camera
105    Player* localPlayer;                //!< The Player, you fly through the level.
106
107    WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
108    Terrain* terrain;                   //!< The Terrain of the World.
109};
110
111#endif /* _WORLD_H */
Note: See TracBrowser for help on using the repository browser.