Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: renamed all the \param → @param and so on in Doxygen tags.
Thanks a lot to the kDevelop team. this took since the last commit :)

File size: 4.3 KB
Line 
1/*!
2    \file world.h
3  *  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 Camera;
17class Player;
18class PNode;
19class GLMenuImageScreen;
20class Terrain;
21class GarbageCollector;
22class Text;
23class TiXmlElement;
24class PilotNode;
25
26//! The game world Interface
27/**
28   this is a singleton interface, that enables world_entities to access the
29   world. for those objects, there is no easier way than over this interface!
30*/
31class WorldInterface : BaseObject {
32
33 public:
34  ~WorldInterface();
35  static WorldInterface* getInstance();
36  void init(World* world);
37  inline World* getCurrentWorld() {return this->worldReference;}
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
90  const char* getPath();
91  void setPath( const char* name);
92
93  inline Camera* getLocalCamera() {return this->localCamera;}
94
95 private:
96  void constuctorInit(char* name, int worldID);
97
98  Uint32 lastFrame;                   //!< last time of frame
99  Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
100  Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
101  float dtS;                          //!< The time needed for caluculations in seconds
102  double gameTime;                    //!< this is where the game time is saved
103  bool bQuitOrxonox;                  //!< quit this application
104  bool bQuitCurrentGame;              //!< quit only the current game and return to menu
105  bool bPause;                        //!< pause mode
106
107  GLMenuImageScreen* glmis;           //!< The Level-Loader Display
108
109  char* worldName;                    //!< The name of this World
110  int debugWorldNr;                   //!< The Debug Nr. needed, if something goes wrong
111  char* path;                         //!< The file from which this world is loaded
112
113
114  // IMPORTANT WORLD-ENTITIES
115  PNode* nullParent;                  //!< The zero-point, that everything has as its parent.
116  Camera* localCamera;                //!< The current Camera
117  WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
118  Terrain* terrain;                   //!< The Terrain of the World.
119
120  GLuint objectList;                  //!< temporary: @todo this will be ereased soon
121  tList<WorldEntity>* entities;       //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
122  Player* localPlayer;                //!< The Player, you fly through the level.
123  PilotNode* pilotNode;               //!< THe pilot node to fly with the mouse
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.