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