Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/story_entities/world.h @ 6053

Last change on this file since 6053 was 6048, checked in by bensch, 19 years ago

orxonox/trunk: some fixes, to PNode and world.

File size: 3.9 KB
RevLine 
[4558]1/*!
[5039]2 * @file world.h
[4836]3  *  Holds and manages all game data
[4558]4*/
[1853]5
[3224]6#ifndef _WORLD_H
7#define _WORLD_H
[1853]8
[2190]9#include "stdincl.h"
[3608]10#include "comincl.h"
[2636]11#include "story_entity.h"
[3521]12#include "p_node.h"
[2190]13
[3620]14class World;
15class WorldEntity;
[3634]16class Camera;
[4396]17class Player;
[3634]18class GLMenuImageScreen;
19class Terrain;
[3646]20class GarbageCollector;
[3790]21class Text;
[4261]22class TiXmlElement;
[3790]23
[5206]24class Shell;
[4961]25class OggPlayer;
[6048]26template<class T> class tList;
[3620]27
[3449]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*/
[2636]33class World : public StoryEntity {
[1853]34
35 public:
[4978]36  World (const char* name);
[2636]37  World (int worldID);
[4261]38  World (const TiXmlElement* root = NULL);
[3221]39  virtual ~World ();
[3459]40
[4261]41  void loadParams(const TiXmlElement* root);
42
[3646]43  double getGameTime();
[3459]44
45  /* classes from story-entity */
[3629]46  virtual ErrorMessage preLoad();
[3459]47  virtual ErrorMessage load ();
[3225]48  virtual ErrorMessage init ();
49  virtual ErrorMessage start ();
50  virtual ErrorMessage stop ();
51  virtual ErrorMessage pause ();
52  virtual ErrorMessage resume ();
[3459]53  virtual ErrorMessage destroy ();
[1917]54
[4010]55  void loadDebugWorld(int worldID);
56
[3459]57  virtual void displayLoadScreen();
58  virtual void releaseLoadScreen();
[4558]59
[3461]60  /* command node functions */
[3225]61  bool command (Command* cmd);
[3459]62
[3620]63  tList<WorldEntity>* getEntities();
64
[3461]65  /* interface to world */
[3225]66  void spawn (WorldEntity* entity);
[3365]67  void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir);
[4765]68  void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir);
[2644]69
[5205]70  /** @param speed sets the speed of the Game */
71  inline void setSpeed(float speed) { this->speed = speed; };
[4010]72  const char* getPath();
73  void setPath( const char* name);
[3461]74
[5389]75  inline Camera* getLocalCamera() { return this->localCamera; };
[4338]76
[5389]77  void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
[5429]78  void toggleBVVisibility() { this->showBV = !this->showBV; };
[5389]79
[3461]80 private:
[4978]81  void constuctorInit(const char* name, int worldID);
[3462]82  /* function for main-loop */
[3225]83  void mainLoop ();
84  void synchronize ();
[3226]85  void handleInput ();
[3551]86  void tick ();
87  void update ();
[3459]88  void collide ();
[3461]89  void draw ();
[3225]90  void display ();
91  void debug ();
[3365]92
[5389]93  private:
94    bool   showPNodes;                  //!< if the PNodes should be visible.
[5429]95    bool   showBV;                      //!< if the Bounding Volumes should be visible.
[5389]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    GLMenuImageScreen* glmis;           //!< The Level-Loader Display
107
108    int debugWorldNr;                   //!< The Debug Nr. needed, if something goes wrong
109    char* path;                         //!< The file from which this world is loaded
110
111    Shell*     shell;
112    OggPlayer* music;
113
114  // IMPORTANT WORLD-ENTITIES
115    Camera* localCamera;                //!< The current Camera
116    WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
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    Player* localPlayer;                //!< The Player, you fly through the level.
[2190]122};
[1883]123
[3224]124#endif /* _WORLD_H */
Note: See TracBrowser for help on using the repository browser.