Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/util/state.h @ 10754

Last change on this file since 10754 was 10698, checked in by snellen, 18 years ago

merged adm, hud, vs-enhancements : beni's responsible for this commit. blame him!

File size: 6.5 KB
RevLine 
[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]11class PNode;
[7014]12class Camera;
13class CameraTarget;
[4827]14class WorldEntity;
[6498]15class Player;
16class SkyBox;
17class StoryEntity;
[6142]18class ObjectManager;
[7039]19class GameRules;
[10379]20class CameraMan;
[8271]21class ScriptManager;
[10698]22class 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 */
31class 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; };
[10643]96  /** @param sets wireframemode */
97  static inline void showWireframe(bool wireframe) { State::bWireframe = wireframe; }
98  /** @retirms the wireframemode */
99  static inline bool showWireframe() { return State::bWireframe; }
[6142]100
[6498]101
[6695]102  ///////////////
103  /// NETWORK ///
104  ///////////////
105  /** sets the online stat (multiplayer network) @param bOnline is true if node is online */
106  static inline void setOnline(bool bOnline) { State::bOnline = bOnline; }
107  /** @returns true if this node is online (multiplayer network game) */
108  static bool isOnline() { return State::bOnline; }
[6498]109
[6695]110
[8271]111
112  ////////////////////
[8408]113  /// SCRIPT_ENGINE ///
[8271]114  ////////////////////
[8408]115  static void setScriptManager(ScriptManager* scriptManager) { State::scriptManager = scriptManager; };
[8271]116  static ScriptManager* getScriptManager() { return State::scriptManager; };
117
[6874]118  ////////////
119  /// Menu ///
120  ////////////
121  /** sets the menu mode @param mode true if always exit to menu */
[7032]122  static inline void setMenuID(int menuID) { State::menuID = menuID; }
[6874]123  /** @returns the menu mode */
[7032]124  static inline int getMenuID() { return State::menuID;}
[6874]125
[10368]126  ////////////////////////
127  /// Scroller-Control ///
128  ////////////////////////
129  /** sets the scroller-travelnode (center of the screen) */
130  static void setTravelNode(PNode* travelNode) {State::travelNode = travelNode;}
131  /** @returns the scroller-travelnode (center of the screen) */
132  static PNode* getTravelNode() { return State::travelNode; }
[10698]133 
134  /** sets the action box (this is where the fighting takes place) */
135  static void setActionBox( ActionBox* ab ){ State::actionBox = ab; }
136  /** @returns the action box (this is where the fighting takes place) */
137  static ActionBox* getActionBox(){ return State::actionBox; }
[6874]138
139
[3655]140 private:
[4746]141  State();
[4293]142
[7014]143  static Camera*                camera;             //!< The current Camera.
144  static CameraTarget*          cameraTarget;       //!< The Camera Target.
[10379]145  static CameraMan*             cameraManager;
[7014]146  static PNode*                 cameraNode;         //!< A reference to the camera
147  static PNode*                 cameraTargetNode;   //!< A reference to the cameraTarget
[5405]148  static PNode*                 nullParent;         //!< A reference to the Null-PNode.
[6498]149  static ObjectManager*         objectManager;      //!< A reference to the current ObjectManager
150  static StoryEntity*           storyEntity;        //!< A reference to the current StoryEntity played
[7039]151  static GameRules*             gameRules;          //!< A reference to the GameRules
[6498]152  static Player*                player;             //!< A reference to the Player
[10368]153  static PNode*                 travelNode;         //!< A reference to the scroller-travelnode
[10698]154  static ActionBox*             actionBox;          //!< A reference to the action box
[4827]155
[6498]156  static SkyBox*                skyBox;            //!< The SkyBox used in the current world.
[8271]157
158  static  ScriptManager*        scriptManager;     //!< The ScriptManager.
159
[6498]160  static unsigned int           resX;              //!< The X Resolution of the screen.
161  static unsigned int           resY;              //!< The Y Resolution of the screen.
[7032]162  static int                    menuID;            //!< -1 on default, otherwise orxonox's Menu ID
[6695]163  static bool                   bOnline;           //!< Is true if this node is in multiplayer mode (via network)
[10643]164 
165  static bool                   bWireframe;        //!< The Wireframemode
[6468]166  };
[3655]167
[4293]168#endif /* _STATE_H */
Note: See TracBrowser for help on using the repository browser.