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