/*! * @file game_world.h * container for all game worlds (singleplayers, multiplayers..) */ #ifndef _GAME_WORLD_H #define _GAME_WORLD_H #include "sdlincl.h" #include "story_entity.h" #include "object_manager.h" class WorldEntity; class Camera; class Player; class GLMenuImageScreen; class Terrain; class TiXmlElement; class Shell; class OggPlayer; //! The game world /** * this class initializes everything that should be displayed inside of the current level. * it is the main driving factor during gameplay. */ class GameWorld : public StoryEntity { public: GameWorld (const TiXmlElement* root = NULL); virtual ~GameWorld (); void loadParams(const TiXmlElement* root); /* functions from story-entity */ virtual ErrorMessage init(); virtual ErrorMessage loadData(); virtual ErrorMessage preStart(); virtual ErrorMessage start(); virtual ErrorMessage stop(); virtual ErrorMessage pause(); virtual ErrorMessage resume(); virtual void displayLoadScreen(); virtual void releaseLoadScreen(); /* interface to the game world */ virtual void spawn (WorldEntity* entity); /** this returns the current game time @returns elapsed game time */ inline double getGameTime() { return this->gameTime; } /** sets the game speed @param speed speed of the Game */ inline void setSpeed(float speed) { this->speed = speed; }; /** returns the track path of this world @returns the track path */ const char* getPath() { return path; } void setPath( const char* name); /** toggles the PNode visibility in the world (drawn as boxes) */ void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; }; /** toggles the bounding volume (BV) visibility */ void toggleBVVisibility() { this->showBV = !this->showBV; }; protected: /* world - running functions */ virtual void mainLoop (); virtual void synchronize (); virtual void handleInput (); virtual void tick (std::list worldEntity, float dt); virtual void tick (); virtual void update (); virtual void collide (); virtual void draw (); virtual void display (); protected: char* path; //!< The file from which this world is loaded /* state flags */ bool bQuitWorld; //!< quit only the current game and return to menu bool bPause; //!< pause mode bool showPNodes; //!< if the PNodes should be visible. bool showBV; //!< if the Bounding Volumes should be visible. GLMenuImageScreen* glmis; //!< The Level-Loader Display /* world timing */ Uint32 lastFrame; //!< last time of frame Uint32 cycle; //!< The cycle we are in (starts with 0 and rises with every frame) Uint32 dt; //!< time needed to calculate this frame (in milliSeconds) float dtS; //!< The time needed for caluculations in seconds float speed; //!< how fast the game flows double gameTime; //!< this is where the game time is saved /* external modules interfaces */ ObjectManager objectManager; //!< The ObjectManager of this GameWorld. /* external modules interfaces */ Shell* shell; OggPlayer* music; /* important entities */ Camera* localCamera; //!< The current Camera Player* localPlayer; //!< The Player, you fly through the level. WorldEntity* sky; //!< The Environmental Heaven of orxonox @todo insert this to environment insted Terrain* terrain; //!< The Terrain of the GameWorld. }; #endif /* _GAME_WORLD_H */