Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/height_map/src/story_entities/world.h @ 6266

Last change on this file since 6266 was 6263, checked in by bensch, 19 years ago

heightmap: changes to revert afterwards

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