Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/physics/src/story_entities/world.h @ 4295

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

orxonox/branches/physics: merged the trunk back to branches/physics
merged with command
svn merge -r 4223:HEAD ../../trunk/ .
conflicts additively included

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