Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/levelloader/src/story_entities/world.h @ 3834

Last change on this file since 3834 was 3746, checked in by chris, 19 years ago

orxonox/branches/levelloader: Merged trunk into branch… still not working though…

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
14
15class World;
16class WorldEntity;
17class TrackManager;
18class Camera;
19class PNode;
20class GLMenuImageScreen;
21class Skysphere;
22class LightManager;
23class FontSet;
24class Terrain;
25class GarbageCollector;
26class SimpleAnimation;
27
28//! The game world Interface
29/**
30   this is a singleton interface, that enables world_entities to access the
31   world. for those objects, there is no easier way than over this interface!
32*/
33class WorldInterface : BaseObject {
34
35 public:
36  ~WorldInterface();
37  static WorldInterface* getInstance();
38  void init(World* world);
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*/
54//#define SUBCLASS(x,y) class x : public y {
55
56//SUBCLASS(World,StoryEntity)
57class World : public StoryEntity {
58
59 public:
60        World (TiXmlElement* root);
61  World (char* name);
62  World (int worldID);
63  virtual ~World ();
64
65  double getGameTime();
66
67  /* classes from story-entity */
68  virtual ErrorMessage preLoad();
69  virtual ErrorMessage load ();
70  virtual ErrorMessage init ();
71  virtual ErrorMessage start ();
72  virtual ErrorMessage stop ();
73  virtual ErrorMessage pause ();
74  virtual ErrorMessage resume ();
75  virtual ErrorMessage destroy ();
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       
92        void setPath( char* name);
93        char* getPath();
94
95 private:
96  void init(char* name, int worldID);
97
98  Uint32 lastFrame;                   //!< last time of frame
99  Uint32 dt;                          //!< time needed to calculate this frame
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  FontSet* testFont;                  //!< A test Font. \todo fix this, so it is for real.
106  GLMenuImageScreen* glmis;           //!< The Level-Loader Display
107
108  char* worldName;              //!< The name of this World
109  char* path;                                                                           //!< The path to the data file used by this World
110  int debugWorldNr;             //!< The Debug Nr. needed, if something goes wrong
111
112  PNode* nullParent;                  //!< The zero-point, that everything has as its parent.
113  TrackManager* trackManager;         //!< The reference of the TrackManager that handles the course through the Level.
114  Camera* localCamera;                //!< The current Camera
115  Skysphere* skySphere;               //!< 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  SimpleAnimation* simpleAnimation;   //!< reference to the SimpleAnimation object
126 
127  /* function for main-loop */
128  void mainLoop ();
129  void synchronize ();
130  void handleInput ();
131  void tick ();
132  void update ();
133  void collide ();
134  void draw ();
135  void display ();
136  void debug ();
137
138};
139
140#endif /* _WORLD_H */
Note: See TracBrowser for help on using the repository browser.