| 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 | private: | 
|---|
| 77 | State(); | 
|---|
| 78 |  | 
|---|
| 79 | static PNode*                 camera;             //!< A reference to the camera | 
|---|
| 80 | static PNode*                 cameraTarget;       //!< A reference to the cameraTarget | 
|---|
| 81 | static PNode*                 nullParent;         //!< A reference to the Null-PNode. | 
|---|
| 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 | 
|---|
| 85 |  | 
|---|
| 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. | 
|---|
| 89 | }; | 
|---|
| 90 |  | 
|---|
| 91 | #endif /* _STATE_H */ | 
|---|