Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3620 was 3620, checked in by patrick, 19 years ago

orxonox/trunk: added worldinterface, to enable all worldentities to access the entities list. so they can add entities themselfes. this is a nice hack

File size: 3.5 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;
17
18//! The game world Interface
19/**
20   this is a singleton interface, that enables world_entities to access the
21   world. for those objects, there is no easier way than over this interface!
22*/
23class WorldInterface : BaseObject {
24
25 public:
26  ~WorldInterface();
27  static WorldInterface* getInstance();
28  void init(World* world);
29  tList<WorldEntity>* getEntityList();
30
31 private:
32  WorldInterface();
33  static WorldInterface* singletonRef;    //!< singleton reference to this object
34  bool worldIsInitialized;                //!< true if the world has been initialized
35  World* worldReference;                  //!< this is a reference to the running world
36
37};
38
39
40class TrackManager;
41class Camera;
42class PNode;
43class GLMenuImageScreen;
44class Skysphere;
45class LightManager;
46class FontSet;
47class Terrain;
48
49
50//! The game world
51/**
52   this class initializes everything that should be displayed inside of the current level.
53   it is the main driving factor during gameplay.
54*/
55class World : public StoryEntity {
56
57 public:
58  World (char* name);
59  World (int worldID);
60  virtual ~World ();
61
62
63  /* classes from story-entity */
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  bool bQuitOrxonox;            //!< quit this application
92  bool bQuitCurrentGame;        //!< quit only the current game and return to menu
93  bool bPause;                  //!< pause mode
94
95  FontSet* testFont;            //!< A test Font. \todo fix this, so it is for real.
96  GLMenuImageScreen* glmis;     //!< The Level-Loader Display
97
98  char* worldName;              //!< The name of this World
99  int debugWorldNr;             //!< The Debug Nr. needed, if something goes wrong
100
101  PNode* nullParent;            //!< The zero-point, that everything has as its parent.
102  TrackManager* trackManager;   //!< The reference of the TrackManager that handles the course through the Level.
103  Camera* localCamera;          //!< The current Camera
104  Skysphere* skySphere;         //!< The Environmental Heaven of orxonox \todo insert this to environment insted
105  LightManager* lightMan;       //!< The Lights of the Level
106  Terrain* terrain;             //!< The Terrain of the World.
107
108  GLuint objectList;            //!< temporary: \todo this will be ereased soon
109  tList<WorldEntity>* entities;//!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
110  WorldEntity* localPlayer;     //!< The Player, you fly through the level.
111 
112  /* function for main-loop */
113  void mainLoop ();
114  void synchronize ();
115  void handleInput ();
116  void tick ();
117  void update ();
118  void collide ();
119  void draw ();
120  void display ();
121  void debug ();
122
123};
124
125#endif /* _WORLD_H */
Note: See TracBrowser for help on using the repository browser.