1 | /*! |
---|
2 | \file world.h |
---|
3 | \brief 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 | |
---|
14 | |
---|
15 | class World; |
---|
16 | class WorldEntity; |
---|
17 | class TrackManager; |
---|
18 | class Camera; |
---|
19 | class PNode; |
---|
20 | class GLMenuImageScreen; |
---|
21 | class Skysphere; |
---|
22 | class SkyBox; |
---|
23 | class LightManager; |
---|
24 | class Terrain; |
---|
25 | class GarbageCollector; |
---|
26 | class SimpleAnimation; |
---|
27 | template<class T> class tAnim; |
---|
28 | class Text; |
---|
29 | |
---|
30 | //! The game world Interface |
---|
31 | /** |
---|
32 | this is a singleton interface, that enables world_entities to access the |
---|
33 | world. for those objects, there is no easier way than over this interface! |
---|
34 | */ |
---|
35 | class WorldInterface : BaseObject { |
---|
36 | |
---|
37 | public: |
---|
38 | ~WorldInterface(); |
---|
39 | static WorldInterface* getInstance(); |
---|
40 | void init(World* world); |
---|
41 | tList<WorldEntity>* getEntityList(); |
---|
42 | |
---|
43 | private: |
---|
44 | WorldInterface(); |
---|
45 | static WorldInterface* singletonRef; //!< singleton reference to this object |
---|
46 | bool worldIsInitialized; //!< true if the world has been initialized |
---|
47 | World* worldReference; //!< this is a reference to the running world |
---|
48 | |
---|
49 | }; |
---|
50 | |
---|
51 | //! The game world |
---|
52 | /** |
---|
53 | this class initializes everything that should be displayed inside of the current level. |
---|
54 | it is the main driving factor during gameplay. |
---|
55 | */ |
---|
56 | class World : public StoryEntity { |
---|
57 | |
---|
58 | public: |
---|
59 | World (char* name); |
---|
60 | World (int worldID); |
---|
61 | virtual ~World (); |
---|
62 | |
---|
63 | double getGameTime(); |
---|
64 | |
---|
65 | /* classes from story-entity */ |
---|
66 | virtual ErrorMessage preLoad(); |
---|
67 | virtual ErrorMessage load (); |
---|
68 | virtual ErrorMessage init (); |
---|
69 | virtual ErrorMessage start (); |
---|
70 | virtual ErrorMessage stop (); |
---|
71 | virtual ErrorMessage pause (); |
---|
72 | virtual ErrorMessage resume (); |
---|
73 | virtual ErrorMessage destroy (); |
---|
74 | |
---|
75 | virtual void displayLoadScreen(); |
---|
76 | virtual void releaseLoadScreen(); |
---|
77 | |
---|
78 | /* command node functions */ |
---|
79 | bool command (Command* cmd); |
---|
80 | |
---|
81 | tList<WorldEntity>* getEntities(); |
---|
82 | |
---|
83 | /* interface to world */ |
---|
84 | void spawn (WorldEntity* entity); |
---|
85 | void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir); |
---|
86 | void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir, |
---|
87 | int parentingMode); |
---|
88 | |
---|
89 | |
---|
90 | private: |
---|
91 | void init(char* name, int worldID); |
---|
92 | |
---|
93 | Uint32 lastFrame; //!< last time of frame |
---|
94 | Uint32 dt; //!< time needed to calculate this frame |
---|
95 | double gameTime; //!< this is where the game time is saved |
---|
96 | bool bQuitOrxonox; //!< quit this application |
---|
97 | bool bQuitCurrentGame; //!< quit only the current game and return to menu |
---|
98 | bool bPause; //!< pause mode |
---|
99 | |
---|
100 | GLMenuImageScreen* glmis; //!< The Level-Loader Display |
---|
101 | |
---|
102 | tAnim<Text>* testAnim; |
---|
103 | Text* testText; //!< A text to Test the TextEngine; |
---|
104 | |
---|
105 | char* worldName; //!< The name of this World |
---|
106 | int debugWorldNr; //!< The Debug Nr. needed, if something goes wrong |
---|
107 | |
---|
108 | PNode* nullParent; //!< The zero-point, that everything has as its parent. |
---|
109 | TrackManager* trackManager; //!< The reference of the TrackManager that handles the course through the Level. |
---|
110 | Camera* localCamera; //!< The current Camera |
---|
111 | Skysphere* skySphere; //!< The Environmental Heaven of orxonox \todo insert this to environment insted |
---|
112 | SkyBox* skyBox; |
---|
113 | LightManager* lightMan; //!< The Lights of the Level |
---|
114 | Terrain* terrain; //!< The Terrain of the World. |
---|
115 | |
---|
116 | GLuint objectList; //!< temporary: \todo this will be ereased soon |
---|
117 | tList<WorldEntity>* entities; //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them. |
---|
118 | WorldEntity* localPlayer; //!< The Player, you fly through the level. |
---|
119 | |
---|
120 | GarbageCollector* garbageCollector; //!< reference to the garbage collector |
---|
121 | |
---|
122 | SimpleAnimation* simpleAnimation; //!< reference to the SimpleAnimation object |
---|
123 | |
---|
124 | /* function for main-loop */ |
---|
125 | void mainLoop (); |
---|
126 | void synchronize (); |
---|
127 | void handleInput (); |
---|
128 | void tick (); |
---|
129 | void update (); |
---|
130 | void collide (); |
---|
131 | void draw (); |
---|
132 | void display (); |
---|
133 | void debug (); |
---|
134 | |
---|
135 | }; |
---|
136 | |
---|
137 | #endif /* _WORLD_H */ |
---|