Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: cleanup of the world begin

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 "stdincl.h"
10#include "comincl.h"
11#include "story_entity.h"
12#include "p_node.h"
13#include "object_manager.h"
14
15
16class WorldEntity;
17class Camera;
18class Player;
19class GLMenuImageScreen;
20class Terrain;
21class TiXmlElement;
22
23class Shell;
24class OggPlayer;
25
26//! The game world
27/**
28   this class initializes everything that should be displayed inside of the current level.
29   it is the main driving factor during gameplay.
30*/
31class World : public StoryEntity {
32
33 public:
34  World (const TiXmlElement* root = NULL);
35  virtual ~World ();
36
37  void loadParams(const TiXmlElement* root);
38
39  double getGameTime();
40
41  /* classes from story-entity */
42  virtual ErrorMessage preLoad();
43  virtual ErrorMessage load ();
44  virtual ErrorMessage init ();
45  virtual ErrorMessage start ();
46  virtual ErrorMessage stop ();
47  virtual ErrorMessage pause ();
48  virtual ErrorMessage resume ();
49  virtual ErrorMessage destroy ();
50
51  virtual void displayLoadScreen();
52  virtual void releaseLoadScreen();
53
54  /* command node functions */
55  bool command (Command* cmd);
56
57  /* interface to world */
58  void spawn (WorldEntity* entity);
59
60  /** @param speed sets the speed of the Game */
61  inline void setSpeed(float speed) { this->speed = speed; };
62  const char* getPath();
63  void setPath( const char* name);
64
65  void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
66  void toggleBVVisibility() { this->showBV = !this->showBV; };
67
68 private:
69  void constuctorInit(const char* name, int worldID);
70  /* function for main-loop */
71  void synchronize ();
72  void handleInput ();
73  void tick (std::list<WorldEntity*> worldEntity, float dt);
74  void tick ();
75  void update ();
76  void collide ();
77  void draw ();
78  void mainLoop ();
79
80  void display ();
81  void debug ();
82
83  private:
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    Uint32 lastFrame;                   //!< last time of frame
90    Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
91    Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
92    float dtS;                          //!< The time needed for caluculations in seconds
93    float speed;                        //!< how fast the game flows
94    double gameTime;                    //!< this is where the game time is saved
95    bool bQuitOrxonox;                  //!< quit this application
96    bool bQuitCurrentGame;              //!< quit only the current game and return to menu
97    bool bPause;                        //!< pause mode
98
99    ObjectManager      objectManager;   //!< The ObjectManager of this World.
100
101    GLMenuImageScreen* glmis;           //!< The Level-Loader Display
102
103    Shell*     shell;
104    OggPlayer* music;
105
106  // IMPORTANT WORLD-ENTITIES
107    Camera* localCamera;                //!< The current Camera
108    WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
109    Terrain* terrain;                   //!< The Terrain of the World.
110
111    Player* localPlayer;                //!< The Player, you fly through the level.
112};
113
114#endif /* _WORLD_H */
Note: See TracBrowser for help on using the repository browser.