1 | /*! |
---|
2 | * @file game_world.h |
---|
3 | * container for all game worlds (singleplayers, multiplayers..) |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _GAME_WORLD_H |
---|
7 | #define _GAME_WORLD_H |
---|
8 | |
---|
9 | |
---|
10 | #include "story_entity.h" |
---|
11 | #include "game_world_data.h" |
---|
12 | |
---|
13 | class TiXmlElement; |
---|
14 | class Shell; |
---|
15 | class WorldEntity; |
---|
16 | class GameWorldData; |
---|
17 | |
---|
18 | |
---|
19 | //! The game world |
---|
20 | /** |
---|
21 | * this class initializes everything that should be displayed inside of the current level. |
---|
22 | * it is the main driving factor during gameplay. |
---|
23 | */ |
---|
24 | class GameWorld : public StoryEntity |
---|
25 | { |
---|
26 | |
---|
27 | public: |
---|
28 | GameWorld (); |
---|
29 | virtual ~GameWorld (); |
---|
30 | |
---|
31 | virtual void loadParams(const TiXmlElement* root); |
---|
32 | |
---|
33 | /* functions from story-entity */ |
---|
34 | virtual ErrorMessage init(); |
---|
35 | virtual ErrorMessage loadData(); |
---|
36 | virtual ErrorMessage unloadData(); |
---|
37 | |
---|
38 | virtual bool start(); |
---|
39 | virtual bool stop(); |
---|
40 | virtual bool pause(); |
---|
41 | virtual bool resume(); |
---|
42 | virtual void run(); |
---|
43 | |
---|
44 | /** this returns the current game time @returns elapsed game time */ |
---|
45 | inline double getGameTime() { return this->gameTime; } |
---|
46 | /** sets the game speed @param speed speed of the Game */ |
---|
47 | inline void setSpeed(float speed) { this->speed = speed; }; |
---|
48 | /** returns the track path of this world @returns the track path */ |
---|
49 | |
---|
50 | static void togglePNodeVisibility(); |
---|
51 | static void toggleBVVisibility(); |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | |
---|
56 | inline void setSky(WorldEntity* sky) { this->dataTank->sky = sky; } |
---|
57 | |
---|
58 | |
---|
59 | protected: |
---|
60 | /* world - running functions */ |
---|
61 | virtual void synchronize(); |
---|
62 | virtual void handleInput(); |
---|
63 | virtual void tick(std::list<WorldEntity*> worldEntity, float dt); |
---|
64 | virtual void tick(); |
---|
65 | virtual void update(); |
---|
66 | virtual void collide(); |
---|
67 | virtual void draw(); |
---|
68 | virtual void display(); |
---|
69 | |
---|
70 | |
---|
71 | private: |
---|
72 | void displayLoadScreen(); |
---|
73 | void releaseLoadScreen(); |
---|
74 | |
---|
75 | |
---|
76 | protected: |
---|
77 | GameWorldData* dataTank; //!< reference to the GameWorld Data Tank |
---|
78 | TiXmlElement* dataXML; //!< The XML-Element this World has been loaded with. |
---|
79 | |
---|
80 | bool showPNodes; //!< if the PNodes should be visible. |
---|
81 | bool showBV; //!< if the Bounding Volumes should be visible. |
---|
82 | |
---|
83 | /* world timing */ |
---|
84 | Uint32 lastFrame; //!< last time of frame |
---|
85 | Uint32 cycle; //!< The cycle we are in (starts with 0 and rises with every frame) |
---|
86 | Uint32 dt; //!< time needed to calculate this frame (in milliSeconds) |
---|
87 | float dtS; //!< The time needed for caluculations in seconds |
---|
88 | float speed; //!< how fast the game flows |
---|
89 | double gameTime; //!< this is where the game time is saved |
---|
90 | |
---|
91 | /* external modules interfaces */ |
---|
92 | Shell* shell; |
---|
93 | }; |
---|
94 | |
---|
95 | #endif /* _GAME_WORLD_H */ |
---|