Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4585 was 4558, checked in by bensch, 19 years ago

orxonox/trunk: PhysicsEngine looks better (it speeds up things… but i do not exactly know if it works

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