| 1 | /*! |
|---|
| 2 | * @file state.h |
|---|
| 3 | * Definition of the States Class |
|---|
| 4 | */ |
|---|
| 5 | |
|---|
| 6 | #ifndef _STATE_H |
|---|
| 7 | #define _STATE_H |
|---|
| 8 | |
|---|
| 9 | // FORWARD DECLARATION |
|---|
| 10 | class PNode; |
|---|
| 11 | class WorldEntity; |
|---|
| 12 | class ObjectManager; |
|---|
| 13 | class SkyBox; |
|---|
| 14 | class Player; |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | //! handles states about orxonox's most importatn objects |
|---|
| 18 | /** |
|---|
| 19 | * This is an abstract Class-container, not really a Class. |
|---|
| 20 | * in this Class only static references to the most important |
|---|
| 21 | * Objects/List/etc. are stored. |
|---|
| 22 | */ |
|---|
| 23 | class State { |
|---|
| 24 | |
|---|
| 25 | public: |
|---|
| 26 | ////////////// |
|---|
| 27 | /// CAMERA /// |
|---|
| 28 | ////////////// |
|---|
| 29 | /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */ |
|---|
| 30 | static void setCamera(PNode* camera, PNode* cameraTarget); |
|---|
| 31 | /** @returns a Pointer to the PNode of the Camera */ |
|---|
| 32 | static inline PNode* getCamera() { return State::camera; }; |
|---|
| 33 | /** @returns a Pointer to the CameraTarget */ |
|---|
| 34 | static inline PNode* getCameraTarget() { return State::cameraTarget; }; |
|---|
| 35 | |
|---|
| 36 | /** @returns the Local Player */ |
|---|
| 37 | static inline Player* localsPlayer() { return State::_localPlayer; }; |
|---|
| 38 | /** @param localPlayer the local Player */ |
|---|
| 39 | static inline void setLocalPlayer(Player* localPlayer) { State::_localPlayer = localPlayer; }; |
|---|
| 40 | |
|---|
| 41 | /** @returns the current SkyBox */ |
|---|
| 42 | static inline SkyBox* skyBox() { return State::_skyBox; }; |
|---|
| 43 | /** @param skyBox the SkyBox */ |
|---|
| 44 | static inline SkyBox* setSkyBox(SkyBox* skyBox) { State::_skyBox = skyBox; }; |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | ////////////////////// |
|---|
| 48 | /// OBJECT-MANAGER /// |
|---|
| 49 | ////////////////////// |
|---|
| 50 | /** @param objectManager the new Current ObjectManager */ |
|---|
| 51 | static inline void setObjectManager(ObjectManager* objectManager) { State::objectManager = objectManager; }; |
|---|
| 52 | /** @returns the current ObjectManager. */ |
|---|
| 53 | static inline ObjectManager* getObjectManager() { return State::objectManager; }; |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | static inline void setResolution(unsigned int resX, unsigned int resY) { State::_resX = resX; State::_resY = resY; }; |
|---|
| 57 | static inline unsigned int resX() { return State::_resX; }; |
|---|
| 58 | static inline unsigned int resY() { return State::_resY; }; |
|---|
| 59 | |
|---|
| 60 | ///////////////////////// |
|---|
| 61 | /// WORLD_ENTITY_LIST /// |
|---|
| 62 | ///////////////////////// |
|---|
| 63 | |
|---|
| 64 | private: |
|---|
| 65 | State(); |
|---|
| 66 | |
|---|
| 67 | static PNode* camera; //!< A reference to the camera |
|---|
| 68 | static PNode* cameraTarget; //!< A reference to the cameraTarget |
|---|
| 69 | static PNode* nullParent; //!< A reference to the Null-PNode. |
|---|
| 70 | static ObjectManager* objectManager; //!< A referenct to the current ObjectManager |
|---|
| 71 | |
|---|
| 72 | static Player* _localPlayer; //!< The Local Player. |
|---|
| 73 | static SkyBox* _skyBox; //!< The SkyBox used in the current world. |
|---|
| 74 | static unsigned int _resX; //!< The X Resolution of the screen. |
|---|
| 75 | static unsigned int _resY; //!< The Y Resolution of the screen. |
|---|
| 76 | }; |
|---|
| 77 | |
|---|
| 78 | #endif /* _STATE_H */ |
|---|