Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/preferences/src/story_entities/world.h @ 6483

Last change on this file since 6483 was 6152, checked in by bensch, 19 years ago

orxonox/trunk: some work in the loading process of worlds

File size: 3.3 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 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  void displayLoadScreen();
51  void releaseLoadScreen();
52
53  /* interface to world */
54  void spawn (WorldEntity* entity);
55
56  /** @param speed sets the speed of the Game */
57  inline void setSpeed(float speed) { this->speed = speed; };
58  const char* getPath();
59  void setPath( const char* name);
60
61  void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
62  void toggleBVVisibility() { this->showBV = !this->showBV; };
63
64 private:
65  void constuctorInit(const char* name, int worldID);
66  /* function for main-loop */
67  void synchronize ();
68  void handleInput ();
69  void tick (std::list<WorldEntity*> worldEntity, float dt);
70  void tick ();
71  void update ();
72  void collide ();
73  void draw ();
74  void mainLoop ();
75
76  void display ();
77  void debug ();
78
79  private:
80    char* path;                         //!< The file from which this world is loaded
81
82    // FLAGS //
83    bool bQuitWorld;                    //!< quit only the current game and return to menu
84    bool bPause;                        //!< pause mode
85
86    bool showPNodes;                    //!< if the PNodes should be visible.
87    bool showBV;                        //!< if the Bounding Volumes should be visible.
88
89    // 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    // INTERNAL ENGINES
98    ObjectManager objectManager;        //!< The ObjectManager of this World.
99    Shell*     shell;
100    OggPlayer* music;
101
102    GLMenuImageScreen* glmis;           //!< The Level-Loader Display
103
104
105    // IMPORTANT ENTITIES
106    Camera* localCamera;                //!< The current Camera
107    Player* localPlayer;                //!< The Player, you fly through the level.
108
109    WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
110    Terrain* terrain;                   //!< The Terrain of the World.
111};
112
113#endif /* _WORLD_H */
Note: See TracBrowser for help on using the repository browser.