Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3658 was 3646, checked in by patrick, 20 years ago

orxonox/trunk: implemented garbage collector, is not yet collecting, i have to update the list.h first.

File size: 3.8 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
14
15class World;
16class WorldEntity;
17class TrackManager;
18class Camera;
19class PNode;
20class GLMenuImageScreen;
21class Skysphere;
22class LightManager;
23class FontSet;
24class Terrain;
25class GarbageCollector;
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  virtual ~World ();
59
60  double getGameTime();
61
62  /* classes from story-entity */
63  virtual ErrorMessage preLoad();
64  virtual ErrorMessage load ();
65  virtual ErrorMessage init ();
66  virtual ErrorMessage start ();
67  virtual ErrorMessage stop ();
68  virtual ErrorMessage pause ();
69  virtual ErrorMessage resume ();
70  virtual ErrorMessage destroy ();
71
72  virtual void displayLoadScreen();
73  virtual void releaseLoadScreen();
74 
75  /* command node functions */
76  bool command (Command* cmd);
77
78  tList<WorldEntity>* getEntities();
79
80  /* interface to world */
81  void spawn (WorldEntity* entity);
82  void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir);
83  void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir, 
84             int parentingMode);
85
86
87 private:
88  void init(char* name, int worldID);
89
90  Uint32 lastFrame;             //!< last time of frame
91  Uint32 dt;                    //!< time needed to calculate this frame
92  double gameTime;              //!< this is where the game time is saved
93  bool bQuitOrxonox;            //!< quit this application
94  bool bQuitCurrentGame;        //!< quit only the current game and return to menu
95  bool bPause;                  //!< pause mode
96
97  FontSet* testFont;            //!< A test Font. \todo fix this, so it is for real.
98  GLMenuImageScreen* glmis;     //!< The Level-Loader Display
99
100  char* worldName;              //!< The name of this World
101  int debugWorldNr;             //!< The Debug Nr. needed, if something goes wrong
102
103  PNode* nullParent;            //!< The zero-point, that everything has as its parent.
104  TrackManager* trackManager;   //!< The reference of the TrackManager that handles the course through the Level.
105  Camera* localCamera;          //!< The current Camera
106  Skysphere* skySphere;         //!< The Environmental Heaven of orxonox \todo insert this to environment insted
107  LightManager* lightMan;       //!< The Lights of the Level
108  Terrain* terrain;             //!< The Terrain of the World.
109
110  GLuint objectList;            //!< temporary: \todo this will be ereased soon
111  tList<WorldEntity>* entities;//!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
112  WorldEntity* localPlayer;     //!< The Player, you fly through the level.
113
114  GarbageCollector* garbageCollector; //!< reference to the garbage  collector
115 
116  /* function for main-loop */
117  void mainLoop ();
118  void synchronize ();
119  void handleInput ();
120  void tick ();
121  void update ();
122  void collide ();
123  void draw ();
124  void display ();
125  void debug ();
126
127};
128
129#endif /* _WORLD_H */
Note: See TracBrowser for help on using the repository browser.