Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: the Sky is farther now

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