/*! * @file state.h * Definition of the States Class */ #ifndef _STATE_H #define _STATE_H // FORWARD DECLARATION class PNode; class Camera; class CameraTarget; class WorldEntity; class Player; class SkyBox; class StoryEntity; class ObjectManager; //! handles states about orxonox's most importatn objects /** * This is an abstract Class-container, not really a Class. * in this Class only static references to the most important * Objects/List/etc. are stored. */ class State { public: ////////////// /// CAMERA /// ////////////// /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */ static void setCamera(Camera* camera, CameraTarget* cameraTarget); static inline Camera* getCamera() { return State::camera; }; static inline CameraTarget* getCameraTarget() { return State::cameraTarget; }; /** @returns a Pointer to the PNode of the Camera */ static inline PNode* getCameraNode() { return State::cameraNode; }; /** @returns a Pointer to the CameraTarget */ static inline PNode* getCameraTargetNode() { return State::cameraTargetNode; }; //////////////// /// SKYBOX /// //////////////// /** @returns the current SkyBox */ static inline SkyBox* getSkyBox() { return State::skyBox; }; /** @param skyBox the SkyBox */ static inline SkyBox* setSkyBox(SkyBox* skyBox) { State::skyBox = skyBox; }; ////////////////////// /// OBJECT-MANAGER /// ////////////////////// /** @param objectManager the new Current ObjectManager */ static inline void setObjectManager(ObjectManager* objectManager) { State::objectManager = objectManager; }; /** @returns the current ObjectManager. */ static inline ObjectManager* getObjectManager() { return State::objectManager; }; static inline void setResolution(unsigned int resX, unsigned int resY) { State::resX = resX; State::resY = resY; }; static inline unsigned int getResX() { return State::resX; }; static inline unsigned int getResY() { return State::resY; }; ////////////////////// /// STORY-ENTITY /// ////////////////////// /** @param storyEntity sets the current StoryEntity that is been played */ static inline void setCurrentStoryEntity(StoryEntity* storyEntity) { State::storyEntity = storyEntity; }; /** @returns the current StoryEntity played */ static inline StoryEntity* getCurrentStoryEntity() { return State::storyEntity; }; ////////////// /// PLAYER /// ////////////// /** @param player sets the current local player */ static inline void setPlayer(Player* player) { State::player = player; }; /** @returns the local player*/ static inline Player* getPlayer() { return State::player; }; /////////////// /// NETWORK /// /////////////// /** sets the online stat (multiplayer network) @param bOnline is true if node is online */ static inline void setOnline(bool bOnline) { State::bOnline = bOnline; } /** @returns true if this node is online (multiplayer network game) */ static bool isOnline() { return State::bOnline; } //////////// /// Menu /// //////////// /** sets the menu mode @param mode true if always exit to menu */ static inline void setMenuMode(bool mode) { State::bMenuMode = mode; } /** @returns the menu mode */ static inline bool getMenuMode() { return State::bMenuMode;} private: State(); static Camera* camera; //!< The current Camera. static CameraTarget* cameraTarget; //!< The Camera Target. static PNode* cameraNode; //!< A reference to the camera static PNode* cameraTargetNode; //!< A reference to the cameraTarget static PNode* nullParent; //!< A reference to the Null-PNode. static ObjectManager* objectManager; //!< A reference to the current ObjectManager static StoryEntity* storyEntity; //!< A reference to the current StoryEntity played static Player* player; //!< A reference to the Player static SkyBox* skyBox; //!< The SkyBox used in the current world. static unsigned int resX; //!< The X Resolution of the screen. static unsigned int resY; //!< The Y Resolution of the screen. static bool bOnline; //!< Is true if this node is in multiplayer mode (via network) static bool bMenuMode; //!< True is orxonox is player in the menu mode (always returning to the menu after exit) }; #endif /* _STATE_H */