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 WorldEntity; |
---|
13 | class Player; |
---|
14 | class SkyBox; |
---|
15 | class StoryEntity; |
---|
16 | class ObjectManager; |
---|
17 | |
---|
18 | |
---|
19 | //! handles states about orxonox's most importatn objects |
---|
20 | /** |
---|
21 | * This is an abstract Class-container, not really a Class. |
---|
22 | * in this Class only static references to the most important |
---|
23 | * Objects/List/etc. are stored. |
---|
24 | */ |
---|
25 | class State { |
---|
26 | |
---|
27 | public: |
---|
28 | ////////////// |
---|
29 | /// CAMERA /// |
---|
30 | ////////////// |
---|
31 | /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */ |
---|
32 | static void setCamera(PNode* camera, PNode* cameraTarget); |
---|
33 | /** @returns a Pointer to the PNode of the Camera */ |
---|
34 | static inline PNode* getCamera() { return State::camera; }; |
---|
35 | /** @returns a Pointer to the CameraTarget */ |
---|
36 | static inline PNode* getCameraTarget() { return State::cameraTarget; }; |
---|
37 | |
---|
38 | //////////////// |
---|
39 | /// SKYBOX /// |
---|
40 | //////////////// |
---|
41 | /** @returns the current SkyBox */ |
---|
42 | static inline SkyBox* getSkyBox() { return State::skyBox; }; |
---|
43 | /** @param skyBox the SkyBox */ |
---|
44 | static inline SkyBox* setSkyBox(SkyBox* skyBox) { State::skyBox = skyBox; }; |
---|
45 | |
---|
46 | ////////////////////// |
---|
47 | /// OBJECT-MANAGER /// |
---|
48 | ////////////////////// |
---|
49 | /** @param objectManager the new Current ObjectManager */ |
---|
50 | static inline void setObjectManager(ObjectManager* objectManager) { State::objectManager = objectManager; }; |
---|
51 | /** @returns the current ObjectManager. */ |
---|
52 | static inline ObjectManager* getObjectManager() { return State::objectManager; }; |
---|
53 | |
---|
54 | static inline void setResolution(unsigned int resX, unsigned int resY) { State::resX = resX; State::resY = resY; }; |
---|
55 | static inline unsigned int getResX() { return State::resX; }; |
---|
56 | static inline unsigned int getResY() { return State::resY; }; |
---|
57 | |
---|
58 | ////////////////////// |
---|
59 | /// STORY-ENTITY /// |
---|
60 | ////////////////////// |
---|
61 | /** @param storyEntity sets the current StoryEntity that is been played */ |
---|
62 | static inline void setCurrentStoryEntity(StoryEntity* storyEntity) { State::storyEntity = storyEntity; }; |
---|
63 | /** @returns the current StoryEntity played */ |
---|
64 | static inline StoryEntity* getCurrentStoryEntity() { return State::storyEntity; }; |
---|
65 | |
---|
66 | ////////////// |
---|
67 | /// PLAYER /// |
---|
68 | ////////////// |
---|
69 | /** @param player sets the current local player */ |
---|
70 | static inline void setPlayer(Player* player) { State::player = player; }; |
---|
71 | /** @returns the local player*/ |
---|
72 | static inline Player* getPlayer() { return State::player; }; |
---|
73 | |
---|
74 | |
---|
75 | /////////////// |
---|
76 | /// NETWORK /// |
---|
77 | /////////////// |
---|
78 | /** sets the online stat (multiplayer network) @param bOnline is true if node is online */ |
---|
79 | static inline void setOnline(bool bOnline) { State::bOnline = bOnline; } |
---|
80 | /** @returns true if this node is online (multiplayer network game) */ |
---|
81 | static bool isOnline() { return State::bOnline; } |
---|
82 | |
---|
83 | |
---|
84 | private: |
---|
85 | State(); |
---|
86 | |
---|
87 | static PNode* camera; //!< A reference to the camera |
---|
88 | static PNode* cameraTarget; //!< A reference to the cameraTarget |
---|
89 | static PNode* nullParent; //!< A reference to the Null-PNode. |
---|
90 | static ObjectManager* objectManager; //!< A reference to the current ObjectManager |
---|
91 | static StoryEntity* storyEntity; //!< A reference to the current StoryEntity played |
---|
92 | static Player* player; //!< A reference to the Player |
---|
93 | |
---|
94 | static SkyBox* skyBox; //!< The SkyBox used in the current world. |
---|
95 | static unsigned int resX; //!< The X Resolution of the screen. |
---|
96 | static unsigned int resY; //!< The Y Resolution of the screen. |
---|
97 | |
---|
98 | static bool bOnline; //!< Is true if this node is in multiplayer mode (via network) |
---|
99 | |
---|
100 | }; |
---|
101 | |
---|
102 | #endif /* _STATE_H */ |
---|