Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4403 was 4396, checked in by bensch, 20 years ago

orxonox/trunk: now Objects should be affected by the PhysicsEngine too

File size: 4.6 KB
Line 
1/*!
2    \file world.h
3    \brief 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
14class World;
15class WorldEntity;
16class TrackManager;
17class Camera;
18class Player;
19class PNode;
20class GLMenuImageScreen;
21class LightManager;
22class ParticleEngine;
23class Terrain;
24class GarbageCollector;
25class Text;
26class TiXmlElement;
27class PilotNode;
28
29//! The game world Interface
30/**
31   this is a singleton interface, that enables world_entities to access the
32   world. for those objects, there is no easier way than over this interface!
33*/
34class WorldInterface : BaseObject {
35
36 public:
37  ~WorldInterface();
38  static WorldInterface* getInstance();
39  void init(World* world);
40  inline World* getCurrentWorld(void) {return this->worldReference;}
41  tList<WorldEntity>* getEntityList();
42
43 private:
44  WorldInterface();
45  static WorldInterface* singletonRef;    //!< singleton reference to this object
46  bool worldIsInitialized;                //!< true if the world has been initialized
47  World* worldReference;                  //!< this is a reference to the running world
48
49};
50
51//! The game world
52/**
53   this class initializes everything that should be displayed inside of the current level.
54   it is the main driving factor during gameplay.
55*/
56class World : public StoryEntity {
57
58 public:
59  World (char* name);
60  World (int worldID);
61  World (const TiXmlElement* root = NULL);
62  virtual ~World ();
63
64  void loadParams(const TiXmlElement* root);
65
66  double getGameTime();
67
68  /* classes from story-entity */
69  virtual ErrorMessage preLoad();
70  virtual ErrorMessage load ();
71  virtual ErrorMessage init ();
72  virtual ErrorMessage start ();
73  virtual ErrorMessage stop ();
74  virtual ErrorMessage pause ();
75  virtual ErrorMessage resume ();
76  virtual ErrorMessage destroy ();
77
78  void loadDebugWorld(int worldID);
79
80  virtual void displayLoadScreen();
81  virtual void releaseLoadScreen();
82 
83  /* command node functions */
84  bool command (Command* cmd);
85
86  tList<WorldEntity>* getEntities();
87
88  /* interface to world */
89  void spawn (WorldEntity* entity);
90  void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir);
91  void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir, 
92             int parentingMode);
93
94  const char* getPath();
95  void setPath( const char* name);
96
97  inline Camera* getLocalCamera(void) {return this->localCamera;}
98
99 private:
100  void constuctorInit(char* name, int worldID);
101
102  Uint32 lastFrame;                   //!< last time of frame
103  Uint32 dt;                          //!< time needed to calculate this frame
104  float dtS;                          //!< The time needed for caluculations in seconds
105  double gameTime;                    //!< this is where the game time is saved
106  bool bQuitOrxonox;                  //!< quit this application
107  bool bQuitCurrentGame;              //!< quit only the current game and return to menu
108  bool bPause;                        //!< pause mode
109
110  GLMenuImageScreen* glmis;           //!< The Level-Loader Display
111
112  char* worldName;                    //!< The name of this World
113  int debugWorldNr;                   //!< The Debug Nr. needed, if something goes wrong
114  char* path;                         //!< The file from which this world is loaded
115
116  PNode* nullParent;                  //!< The zero-point, that everything has as its parent.
117  TrackManager* trackManager;         //!< The reference of the TrackManager that handles the course through the Level.
118  ParticleEngine* particleEngine;     //!< The ParticleEngine of the World.
119  Camera* localCamera;                //!< The current Camera
120  WorldEntity* sky;                   //!< The Environmental Heaven of orxonox \todo insert this to environment insted
121  LightManager* lightMan;             //!< The Lights of the Level
122  Terrain* terrain;                   //!< The Terrain of the World.
123
124  GLuint objectList;                  //!< temporary: \todo this will be ereased soon
125  tList<WorldEntity>* entities;       //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
126  Player* localPlayer;                //!< The Player, you fly through the level.
127  PilotNode* pilotNode;               //!< THe pilot node to fly with the mouse
128
129  GarbageCollector* garbageCollector; //!< reference to the garbage  collector
130
131  /* function for main-loop */
132  void mainLoop ();
133  void synchronize ();
134  void handleInput ();
135  void tick ();
136  void update ();
137  void collide ();
138  void draw ();
139  void display ();
140  void debug ();
141
142};
143
144#endif /* _WORLD_H */
Note: See TracBrowser for help on using the repository browser.