Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/2d-recalc/src/story_entities/world.h @ 5822

Last change on this file since 5822 was 5206, checked in by bensch, 19 years ago

orxonox/trunk: Shell no more singleton, and ShellInput is now derive from Text correctly

File size: 3.7 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 private:
79  void constuctorInit(const char* name, int worldID);
80
81  Uint32 lastFrame;                   //!< last time of frame
82  Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
83  Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
84  float dtS;                          //!< The time needed for caluculations in seconds
85  float speed;                        //!< how fast the game flows
86  double gameTime;                    //!< this is where the game time is saved
87  bool bQuitOrxonox;                  //!< quit this application
88  bool bQuitCurrentGame;              //!< quit only the current game and return to menu
89  bool bPause;                        //!< pause mode
90
91  GLMenuImageScreen* glmis;           //!< The Level-Loader Display
92
93  int debugWorldNr;                   //!< The Debug Nr. needed, if something goes wrong
94  char* path;                         //!< The file from which this world is loaded
95
96  Shell*     shell;
97  OggPlayer* music;
98
99  // IMPORTANT WORLD-ENTITIES
100  Camera* localCamera;                //!< The current Camera
101  WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
102  Terrain* terrain;                   //!< The Terrain of the World.
103
104  GLuint objectList;                  //!< temporary: @todo this will be ereased soon
105  tList<WorldEntity>* entities;       //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
106  Player* localPlayer;                //!< The Player, you fly through the level.
107  PilotNode* pilotNode;               //!< THe pilot node to fly with the mouse
108
109  /* function for main-loop */
110  void mainLoop ();
111  void synchronize ();
112  void handleInput ();
113  void tick ();
114  void update ();
115  void collide ();
116  void draw ();
117  void display ();
118  void debug ();
119
120};
121
122#endif /* _WORLD_H */
Note: See TracBrowser for help on using the repository browser.