Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/objectmanager/src/story_entities/world.h @ 6121

Last change on this file since 6121 was 6121, checked in by bensch, 18 years ago

orxonox/trunk: packing the first entities into their lists

File size: 4.0 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#include "object_manager.h"
14
15
16class WorldEntity;
17class Camera;
18class Player;
19class GLMenuImageScreen;
20class Terrain;
21class TiXmlElement;
22
23class Shell;
24class OggPlayer;
25
26template<class T> class tList;
27
28//! The game world
29/**
30   this class initializes everything that should be displayed inside of the current level.
31   it is the main driving factor during gameplay.
32*/
33class World : public StoryEntity {
34
35 public:
36  World (const char* name);
37  World (int worldID);
38  World (const TiXmlElement* root = NULL);
39  virtual ~World ();
40
41  void loadParams(const TiXmlElement* root);
42
43  double getGameTime();
44
45  /* classes from story-entity */
46  virtual ErrorMessage preLoad();
47  virtual ErrorMessage load ();
48  virtual ErrorMessage init ();
49  virtual ErrorMessage start ();
50  virtual ErrorMessage stop ();
51  virtual ErrorMessage pause ();
52  virtual ErrorMessage resume ();
53  virtual ErrorMessage destroy ();
54
55  void loadDebugWorld(int worldID);
56
57  virtual void displayLoadScreen();
58  virtual void releaseLoadScreen();
59
60  /* command node functions */
61  bool command (Command* cmd);
62
63  tList<WorldEntity>* getEntities();
64
65  /* interface to world */
66  void spawn (WorldEntity* entity);
67  void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir);
68  void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir);
69
70  /** @param speed sets the speed of the Game */
71  inline void setSpeed(float speed) { this->speed = speed; };
72  const char* getPath();
73  void setPath( const char* name);
74
75  inline Camera* getLocalCamera() { return this->localCamera; };
76
77  void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
78  void toggleBVVisibility() { this->showBV = !this->showBV; };
79
80 private:
81  void constuctorInit(const char* name, int worldID);
82  /* function for main-loop */
83  void mainLoop ();
84  void synchronize ();
85  void handleInput ();
86  void tick ();
87  void update ();
88  void collide ();
89  void draw ();
90  void display ();
91  void debug ();
92
93  private:
94    bool   showPNodes;                  //!< if the PNodes should be visible.
95    bool   showBV;                      //!< if the Bounding Volumes should be visible.
96    Uint32 lastFrame;                   //!< last time of frame
97    Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
98    Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
99    float dtS;                          //!< The time needed for caluculations in seconds
100    float speed;                        //!< how fast the game flows
101    double gameTime;                    //!< this is where the game time is saved
102    bool bQuitOrxonox;                  //!< quit this application
103    bool bQuitCurrentGame;              //!< quit only the current game and return to menu
104    bool bPause;                        //!< pause mode
105
106    ObjectManager      objectManager;   //!< The ObjectManager of this World.
107
108    GLMenuImageScreen* glmis;           //!< The Level-Loader Display
109
110    int debugWorldNr;                   //!< The Debug Nr. needed, if something goes wrong
111    char* path;                         //!< The file from which this world is loaded
112
113    Shell*     shell;
114    OggPlayer* music;
115
116  // IMPORTANT WORLD-ENTITIES
117    Camera* localCamera;                //!< The current Camera
118    WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
119    Terrain* terrain;                   //!< The Terrain of the World.
120
121    GLuint objectList;                  //!< temporary: @todo this will be ereased soon
122    tList<WorldEntity>* entities;       //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
123    Player* localPlayer;                //!< The Player, you fly through the level.
124};
125
126#endif /* _WORLD_H */
Note: See TracBrowser for help on using the repository browser.