Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/collision_detection/src/story_entities/world.h @ 6461

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

orxonox/trunk: bounding volumes now toggeable via shell

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
14class World;
15class WorldEntity;
16class Camera;
17class Player;
18class PNode;
19class GLMenuImageScreen;
20class Terrain;
21class GarbageCollector;
22class Text;
23class TiXmlElement;
24class PilotNode;
25
26class Shell;
27class OggPlayer;
28
29//! The game world
30/**
31   this class initializes everything that should be displayed inside of the current level.
32   it is the main driving factor during gameplay.
33*/
34class World : public StoryEntity {
35
36 public:
37  World (const char* name);
38  World (int worldID);
39  World (const TiXmlElement* root = NULL);
40  virtual ~World ();
41
42  void loadParams(const TiXmlElement* root);
43
44  double getGameTime();
45
46  /* classes from story-entity */
47  virtual ErrorMessage preLoad();
48  virtual ErrorMessage load ();
49  virtual ErrorMessage init ();
50  virtual ErrorMessage start ();
51  virtual ErrorMessage stop ();
52  virtual ErrorMessage pause ();
53  virtual ErrorMessage resume ();
54  virtual ErrorMessage destroy ();
55
56  void loadDebugWorld(int worldID);
57
58  virtual void displayLoadScreen();
59  virtual void releaseLoadScreen();
60
61  /* command node functions */
62  bool command (Command* cmd);
63
64  tList<WorldEntity>* getEntities();
65
66  /* interface to world */
67  void spawn (WorldEntity* entity);
68  void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir);
69  void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir);
70
71  /** @param speed sets the speed of the Game */
72  inline void setSpeed(float speed) { this->speed = speed; };
73  const char* getPath();
74  void setPath( const char* name);
75
76  inline Camera* getLocalCamera() { return this->localCamera; };
77
78  void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
79  void toggleBVVisibility() { this->showBV = !this->showBV; };
80
81 private:
82  void constuctorInit(const char* name, int worldID);
83  /* function for main-loop */
84  void mainLoop ();
85  void synchronize ();
86  void handleInput ();
87  void tick ();
88  void update ();
89  void collide ();
90  void draw ();
91  void display ();
92  void debug ();
93
94  private:
95    bool   showPNodes;                  //!< if the PNodes should be visible.
96    bool   showBV;                      //!< if the Bounding Volumes should be visible.
97    Uint32 lastFrame;                   //!< last time of frame
98    Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
99    Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
100    float dtS;                          //!< The time needed for caluculations in seconds
101    float speed;                        //!< how fast the game flows
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    int debugWorldNr;                   //!< The Debug Nr. needed, if something goes wrong
110    char* path;                         //!< The file from which this world is loaded
111
112    Shell*     shell;
113    OggPlayer* music;
114
115  // IMPORTANT WORLD-ENTITIES
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
126};
127
128#endif /* _WORLD_H */
Note: See TracBrowser for help on using the repository browser.