/*! * @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); double getGameTime(); /* classes from story-entity */ virtual ErrorMessage preLoad(); virtual ErrorMessage load (); virtual ErrorMessage postLoad(); virtual ErrorMessage preStart(); virtual ErrorMessage start (); virtual ErrorMessage stop (); virtual ErrorMessage pause (); virtual ErrorMessage resume (); virtual ErrorMessage destroy (); virtual void displayLoadScreen(); virtual void releaseLoadScreen(); /* interface to the game world */ virtual void spawn (WorldEntity* entity); /** @param speed sets the speed of the Game */ inline void setSpeed(float speed) { this->speed = speed; }; const char* getPath(); void setPath( const char* name); void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; }; void toggleBVVisibility() { this->showBV = !this->showBV; }; protected: virtual void constuctorInit(const char* name, int worldID); /* 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 */