[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; |
---|
[4827] | 12 | class WorldEntity; |
---|
[6498] | 13 | class Player; |
---|
| 14 | class SkyBox; |
---|
| 15 | class StoryEntity; |
---|
[6142] | 16 | class ObjectManager; |
---|
[3655] | 17 | |
---|
[6468] | 18 | |
---|
[5405] | 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 { |
---|
[3655] | 26 | |
---|
| 27 | public: |
---|
[6142] | 28 | ////////////// |
---|
| 29 | /// CAMERA /// |
---|
| 30 | ////////////// |
---|
[4827] | 31 | /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */ |
---|
[6222] | 32 | static void setCamera(PNode* camera, PNode* cameraTarget); |
---|
[4827] | 33 | /** @returns a Pointer to the PNode of the Camera */ |
---|
[6222] | 34 | static inline PNode* getCamera() { return State::camera; }; |
---|
[4827] | 35 | /** @returns a Pointer to the CameraTarget */ |
---|
[6222] | 36 | static inline PNode* getCameraTarget() { return State::cameraTarget; }; |
---|
[4485] | 37 | |
---|
[6498] | 38 | //////////////// |
---|
| 39 | /// SKYBOX /// |
---|
| 40 | //////////////// |
---|
[6468] | 41 | /** @returns the current SkyBox */ |
---|
[6498] | 42 | static inline SkyBox* getSkyBox() { return State::skyBox; }; |
---|
[6468] | 43 | /** @param skyBox the SkyBox */ |
---|
[6498] | 44 | static inline SkyBox* setSkyBox(SkyBox* skyBox) { State::skyBox = skyBox; }; |
---|
[6468] | 45 | |
---|
[6142] | 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; }; |
---|
[3655] | 53 | |
---|
[6498] | 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; }; |
---|
[6468] | 57 | |
---|
[6498] | 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; }; |
---|
[6441] | 65 | |
---|
[6498] | 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; }; |
---|
[6142] | 73 | |
---|
[6498] | 74 | |
---|
| 75 | |
---|
[3655] | 76 | private: |
---|
[4746] | 77 | State(); |
---|
[4293] | 78 | |
---|
[6222] | 79 | static PNode* camera; //!< A reference to the camera |
---|
| 80 | static PNode* cameraTarget; //!< A reference to the cameraTarget |
---|
[5405] | 81 | static PNode* nullParent; //!< A reference to the Null-PNode. |
---|
[6498] | 82 | static ObjectManager* objectManager; //!< A reference to the current ObjectManager |
---|
| 83 | static StoryEntity* storyEntity; //!< A reference to the current StoryEntity played |
---|
| 84 | static Player* player; //!< A reference to the Player |
---|
[4827] | 85 | |
---|
[6498] | 86 | static SkyBox* skyBox; //!< The SkyBox used in the current world. |
---|
| 87 | static unsigned int resX; //!< The X Resolution of the screen. |
---|
| 88 | static unsigned int resY; //!< The Y Resolution of the screen. |
---|
[6468] | 89 | }; |
---|
[3655] | 90 | |
---|
[4293] | 91 | #endif /* _STATE_H */ |
---|