Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4305 was 4261, checked in by bensch, 20 years ago

orxonox/trunk: merged the levelLoader-branche back into the trunk, because it seems to be stable.
merged with command:
svn merge -r 4230:HEAD levelLoader ../trunk
no conflicts of any interesst

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