[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; |
---|
[7039] | 19 | class GameRules; |
---|
[10379] | 20 | class CameraMan; |
---|
[8271] | 21 | class ScriptManager; |
---|
[6468] | 22 | |
---|
[8271] | 23 | |
---|
[5405] | 24 | //! handles states about orxonox's most importatn objects |
---|
| 25 | /** |
---|
| 26 | * This is an abstract Class-container, not really a Class. |
---|
| 27 | * in this Class only static references to the most important |
---|
| 28 | * Objects/List/etc. are stored. |
---|
| 29 | */ |
---|
| 30 | class State { |
---|
[3655] | 31 | |
---|
| 32 | public: |
---|
[6142] | 33 | ////////////// |
---|
| 34 | /// CAMERA /// |
---|
| 35 | ////////////// |
---|
[4827] | 36 | /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */ |
---|
[7014] | 37 | static void setCamera(Camera* camera, CameraTarget* cameraTarget); |
---|
| 38 | static inline Camera* getCamera() { return State::camera; }; |
---|
| 39 | static inline CameraTarget* getCameraTarget() { return State::cameraTarget; }; |
---|
[4827] | 40 | /** @returns a Pointer to the PNode of the Camera */ |
---|
[7014] | 41 | static inline PNode* getCameraNode() { return State::cameraNode; }; |
---|
[4827] | 42 | /** @returns a Pointer to the CameraTarget */ |
---|
[7014] | 43 | static inline PNode* getCameraTargetNode() { return State::cameraTargetNode; }; |
---|
[4485] | 44 | |
---|
[10379] | 45 | |
---|
| 46 | |
---|
| 47 | ///////////////////// |
---|
| 48 | /// CAMERAMANAGER /// |
---|
| 49 | ///////////////////// |
---|
| 50 | /** @param CameraMan the PNode to the cameraManagerager,*/ |
---|
| 51 | static void setCameraman(CameraMan*); |
---|
| 52 | static inline CameraMan* getCameraman() { return State::cameraManager; }; |
---|
| 53 | |
---|
| 54 | |
---|
[6498] | 55 | //////////////// |
---|
| 56 | /// SKYBOX /// |
---|
| 57 | //////////////// |
---|
[6468] | 58 | /** @returns the current SkyBox */ |
---|
[6498] | 59 | static inline SkyBox* getSkyBox() { return State::skyBox; }; |
---|
[6468] | 60 | /** @param skyBox the SkyBox */ |
---|
[8148] | 61 | static inline void setSkyBox(SkyBox* skyBox) { State::skyBox = skyBox; }; |
---|
[6468] | 62 | |
---|
[6142] | 63 | ////////////////////// |
---|
| 64 | /// OBJECT-MANAGER /// |
---|
| 65 | ////////////////////// |
---|
| 66 | /** @param objectManager the new Current ObjectManager */ |
---|
| 67 | static inline void setObjectManager(ObjectManager* objectManager) { State::objectManager = objectManager; }; |
---|
| 68 | /** @returns the current ObjectManager. */ |
---|
| 69 | static inline ObjectManager* getObjectManager() { return State::objectManager; }; |
---|
[3655] | 70 | |
---|
[6498] | 71 | static inline void setResolution(unsigned int resX, unsigned int resY) { State::resX = resX; State::resY = resY; }; |
---|
| 72 | static inline unsigned int getResX() { return State::resX; }; |
---|
| 73 | static inline unsigned int getResY() { return State::resY; }; |
---|
[6468] | 74 | |
---|
[6498] | 75 | ////////////////////// |
---|
| 76 | /// STORY-ENTITY /// |
---|
| 77 | ////////////////////// |
---|
| 78 | /** @param storyEntity sets the current StoryEntity that is been played */ |
---|
| 79 | static inline void setCurrentStoryEntity(StoryEntity* storyEntity) { State::storyEntity = storyEntity; }; |
---|
| 80 | /** @returns the current StoryEntity played */ |
---|
| 81 | static inline StoryEntity* getCurrentStoryEntity() { return State::storyEntity; }; |
---|
[6441] | 82 | |
---|
[7039] | 83 | /** @param gameRules sets the current GameRules */ |
---|
| 84 | static inline void setGameRules(GameRules* gameRules) { State::gameRules = gameRules; } |
---|
| 85 | /** @returns the GameRules reference*/ |
---|
| 86 | static inline GameRules* getGameRules() { return State::gameRules; } |
---|
| 87 | |
---|
[6498] | 88 | ////////////// |
---|
| 89 | /// PLAYER /// |
---|
| 90 | ////////////// |
---|
| 91 | /** @param player sets the current local player */ |
---|
| 92 | static inline void setPlayer(Player* player) { State::player = player; }; |
---|
| 93 | /** @returns the local player*/ |
---|
| 94 | static inline Player* getPlayer() { return State::player; }; |
---|
[10643] | 95 | /** @param sets wireframemode */ |
---|
| 96 | static inline void showWireframe(bool wireframe) { State::bWireframe = wireframe; } |
---|
| 97 | /** @retirms the wireframemode */ |
---|
| 98 | static inline bool showWireframe() { return State::bWireframe; } |
---|
[6142] | 99 | |
---|
[6498] | 100 | |
---|
[6695] | 101 | /////////////// |
---|
| 102 | /// NETWORK /// |
---|
| 103 | /////////////// |
---|
| 104 | /** sets the online stat (multiplayer network) @param bOnline is true if node is online */ |
---|
| 105 | static inline void setOnline(bool bOnline) { State::bOnline = bOnline; } |
---|
| 106 | /** @returns true if this node is online (multiplayer network game) */ |
---|
| 107 | static bool isOnline() { return State::bOnline; } |
---|
[6498] | 108 | |
---|
[6695] | 109 | |
---|
[8271] | 110 | |
---|
| 111 | //////////////////// |
---|
[8408] | 112 | /// SCRIPT_ENGINE /// |
---|
[8271] | 113 | //////////////////// |
---|
[8408] | 114 | static void setScriptManager(ScriptManager* scriptManager) { State::scriptManager = scriptManager; }; |
---|
[8271] | 115 | static ScriptManager* getScriptManager() { return State::scriptManager; }; |
---|
| 116 | |
---|
[6874] | 117 | //////////// |
---|
| 118 | /// Menu /// |
---|
| 119 | //////////// |
---|
| 120 | /** sets the menu mode @param mode true if always exit to menu */ |
---|
[7032] | 121 | static inline void setMenuID(int menuID) { State::menuID = menuID; } |
---|
[6874] | 122 | /** @returns the menu mode */ |
---|
[7032] | 123 | static inline int getMenuID() { return State::menuID;} |
---|
[6874] | 124 | |
---|
[10368] | 125 | //////////////////////// |
---|
| 126 | /// Scroller-Control /// |
---|
| 127 | //////////////////////// |
---|
| 128 | /** sets the scroller-travelnode (center of the screen) */ |
---|
| 129 | static void setTravelNode(PNode* travelNode) {State::travelNode = travelNode;} |
---|
| 130 | /** @returns the scroller-travelnode (center of the screen) */ |
---|
| 131 | static PNode* getTravelNode() { return State::travelNode; } |
---|
[6874] | 132 | |
---|
| 133 | |
---|
[3655] | 134 | private: |
---|
[4746] | 135 | State(); |
---|
[4293] | 136 | |
---|
[7014] | 137 | static Camera* camera; //!< The current Camera. |
---|
| 138 | static CameraTarget* cameraTarget; //!< The Camera Target. |
---|
[10379] | 139 | static CameraMan* cameraManager; |
---|
[7014] | 140 | static PNode* cameraNode; //!< A reference to the camera |
---|
| 141 | static PNode* cameraTargetNode; //!< A reference to the cameraTarget |
---|
[5405] | 142 | static PNode* nullParent; //!< A reference to the Null-PNode. |
---|
[6498] | 143 | static ObjectManager* objectManager; //!< A reference to the current ObjectManager |
---|
| 144 | static StoryEntity* storyEntity; //!< A reference to the current StoryEntity played |
---|
[7039] | 145 | static GameRules* gameRules; //!< A reference to the GameRules |
---|
[6498] | 146 | static Player* player; //!< A reference to the Player |
---|
[10368] | 147 | static PNode* travelNode; //!< A reference to the scroller-travelnode |
---|
[4827] | 148 | |
---|
[6498] | 149 | static SkyBox* skyBox; //!< The SkyBox used in the current world. |
---|
[8271] | 150 | |
---|
| 151 | static ScriptManager* scriptManager; //!< The ScriptManager. |
---|
| 152 | |
---|
[6498] | 153 | static unsigned int resX; //!< The X Resolution of the screen. |
---|
| 154 | static unsigned int resY; //!< The Y Resolution of the screen. |
---|
[7032] | 155 | static int menuID; //!< -1 on default, otherwise orxonox's Menu ID |
---|
[6695] | 156 | static bool bOnline; //!< Is true if this node is in multiplayer mode (via network) |
---|
[10643] | 157 | |
---|
| 158 | static bool bWireframe; //!< The Wireframemode |
---|
[6468] | 159 | }; |
---|
[3655] | 160 | |
---|
[4293] | 161 | #endif /* _STATE_H */ |
---|