1 | /*! |
---|
2 | * @file state.h |
---|
3 | * Definition of the States Class |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _STATE_H |
---|
7 | #define _STATE_H |
---|
8 | |
---|
9 | |
---|
10 | // FORWARD DECLARATION |
---|
11 | class PNode; |
---|
12 | class Camera; |
---|
13 | class CameraTarget; |
---|
14 | class WorldEntity; |
---|
15 | class Player; |
---|
16 | class SkyBox; |
---|
17 | class StoryEntity; |
---|
18 | class ObjectManager; |
---|
19 | class GameRules; |
---|
20 | |
---|
21 | class ScriptManager; |
---|
22 | |
---|
23 | |
---|
24 | //! handles states about orxonox's most importatn objects |
---|
25 | /** |
---|
26 | * This is an abstract Class-container, not really a Class. |
---|
27 | * in this Class only static references to the most important |
---|
28 | * Objects/List/etc. are stored. |
---|
29 | */ |
---|
30 | class State { |
---|
31 | |
---|
32 | public: |
---|
33 | ////////////// |
---|
34 | /// CAMERA /// |
---|
35 | ////////////// |
---|
36 | /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */ |
---|
37 | static void setCamera(Camera* camera, CameraTarget* cameraTarget); |
---|
38 | static inline Camera* getCamera() { return State::camera; }; |
---|
39 | static inline CameraTarget* getCameraTarget() { return State::cameraTarget; }; |
---|
40 | /** @returns a Pointer to the PNode of the Camera */ |
---|
41 | static inline PNode* getCameraNode() { return State::cameraNode; }; |
---|
42 | /** @returns a Pointer to the CameraTarget */ |
---|
43 | static inline PNode* getCameraTargetNode() { return State::cameraTargetNode; }; |
---|
44 | |
---|
45 | //////////////// |
---|
46 | /// SKYBOX /// |
---|
47 | //////////////// |
---|
48 | /** @returns the current SkyBox */ |
---|
49 | static inline SkyBox* getSkyBox() { return State::skyBox; }; |
---|
50 | /** @param skyBox the SkyBox */ |
---|
51 | static inline void setSkyBox(SkyBox* skyBox) { State::skyBox = skyBox; }; |
---|
52 | |
---|
53 | ////////////////////// |
---|
54 | /// OBJECT-MANAGER /// |
---|
55 | ////////////////////// |
---|
56 | /** @param objectManager the new Current ObjectManager */ |
---|
57 | static inline void setObjectManager(ObjectManager* objectManager) { State::objectManager = objectManager; }; |
---|
58 | /** @returns the current ObjectManager. */ |
---|
59 | static inline ObjectManager* getObjectManager() { return State::objectManager; }; |
---|
60 | |
---|
61 | static inline void setResolution(unsigned int resX, unsigned int resY) { State::resX = resX; State::resY = resY; }; |
---|
62 | static inline unsigned int getResX() { return State::resX; }; |
---|
63 | static inline unsigned int getResY() { return State::resY; }; |
---|
64 | |
---|
65 | ////////////////////// |
---|
66 | /// STORY-ENTITY /// |
---|
67 | ////////////////////// |
---|
68 | /** @param storyEntity sets the current StoryEntity that is been played */ |
---|
69 | static inline void setCurrentStoryEntity(StoryEntity* storyEntity) { State::storyEntity = storyEntity; }; |
---|
70 | /** @returns the current StoryEntity played */ |
---|
71 | static inline StoryEntity* getCurrentStoryEntity() { return State::storyEntity; }; |
---|
72 | |
---|
73 | /** @param gameRules sets the current GameRules */ |
---|
74 | static inline void setGameRules(GameRules* gameRules) { State::gameRules = gameRules; } |
---|
75 | /** @returns the GameRules reference*/ |
---|
76 | static inline GameRules* getGameRules() { return State::gameRules; } |
---|
77 | |
---|
78 | ////////////// |
---|
79 | /// PLAYER /// |
---|
80 | ////////////// |
---|
81 | /** @param player sets the current local player */ |
---|
82 | static inline void setPlayer(Player* player) { State::player = player; }; |
---|
83 | /** @returns the local player*/ |
---|
84 | static inline Player* getPlayer() { return State::player; }; |
---|
85 | |
---|
86 | |
---|
87 | /////////////// |
---|
88 | /// NETWORK /// |
---|
89 | /////////////// |
---|
90 | /** sets the online stat (multiplayer network) @param bOnline is true if node is online */ |
---|
91 | static inline void setOnline(bool bOnline) { State::bOnline = bOnline; } |
---|
92 | /** @returns true if this node is online (multiplayer network game) */ |
---|
93 | static bool isOnline() { return State::bOnline; } |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | //////////////////// |
---|
98 | /// SCRIPT_ENGINE /// |
---|
99 | //////////////////// |
---|
100 | static void setScriptManager(ScriptManager* scriptManager) { State::scriptManager = scriptManager; }; |
---|
101 | static ScriptManager* getScriptManager() { return State::scriptManager; }; |
---|
102 | |
---|
103 | //////////// |
---|
104 | /// Menu /// |
---|
105 | //////////// |
---|
106 | /** sets the menu mode @param mode true if always exit to menu */ |
---|
107 | static inline void setMenuID(int menuID) { State::menuID = menuID; } |
---|
108 | /** @returns the menu mode */ |
---|
109 | static inline int getMenuID() { return State::menuID;} |
---|
110 | |
---|
111 | |
---|
112 | |
---|
113 | private: |
---|
114 | State(); |
---|
115 | |
---|
116 | static Camera* camera; //!< The current Camera. |
---|
117 | static CameraTarget* cameraTarget; //!< The Camera Target. |
---|
118 | static PNode* cameraNode; //!< A reference to the camera |
---|
119 | static PNode* cameraTargetNode; //!< A reference to the cameraTarget |
---|
120 | static PNode* nullParent; //!< A reference to the Null-PNode. |
---|
121 | static ObjectManager* objectManager; //!< A reference to the current ObjectManager |
---|
122 | static StoryEntity* storyEntity; //!< A reference to the current StoryEntity played |
---|
123 | static GameRules* gameRules; //!< A reference to the GameRules |
---|
124 | static Player* player; //!< A reference to the Player |
---|
125 | |
---|
126 | static SkyBox* skyBox; //!< The SkyBox used in the current world. |
---|
127 | |
---|
128 | static ScriptManager* scriptManager; //!< The ScriptManager. |
---|
129 | |
---|
130 | static unsigned int resX; //!< The X Resolution of the screen. |
---|
131 | static unsigned int resY; //!< The Y Resolution of the screen. |
---|
132 | static int menuID; //!< -1 on default, otherwise orxonox's Menu ID |
---|
133 | static bool bOnline; //!< Is true if this node is in multiplayer mode (via network) |
---|
134 | }; |
---|
135 | |
---|
136 | #endif /* _STATE_H */ |
---|