Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/presentation/src/util/state.h

Last change on this file was 10698, checked in by snellen, 17 years ago

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

File size: 6.5 KB
Line 
1/*!
2 * @file state.h
3 * Definition of the States Class
4*/
5
6#ifndef _STATE_H
7#define _STATE_H
8
9
10// FORWARD DECLARATION
11class PNode;
12class Camera;
13class CameraTarget;
14class WorldEntity;
15class Player;
16class SkyBox;
17class StoryEntity;
18class ObjectManager;
19class GameRules;
20class CameraMan;
21class ScriptManager;
22class ActionBox;
23
24
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 {
32
33 public:
34   //////////////
35   /// CAMERA ///
36   //////////////
37  /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */
38  static void setCamera(Camera* camera, CameraTarget* cameraTarget);
39  static inline Camera* getCamera() { return State::camera; };
40  static inline CameraTarget* getCameraTarget() { return State::cameraTarget; };
41  /** @returns a Pointer to the PNode of the Camera */
42  static inline PNode* getCameraNode() { return State::cameraNode; };
43  /** @returns a Pointer to the CameraTarget */
44  static inline PNode* getCameraTargetNode() { return State::cameraTargetNode; };
45
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
56  ////////////////
57  /// SKYBOX   ///
58  ////////////////
59  /** @returns the current SkyBox */
60  static inline SkyBox* getSkyBox() { return State::skyBox; };
61  /** @param skyBox the SkyBox */
62  static inline void setSkyBox(SkyBox* skyBox) { State::skyBox = skyBox; };
63
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; };
71
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; };
75
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; };
83
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
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; };
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; }
100
101
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; }
109
110
111
112  ////////////////////
113  /// SCRIPT_ENGINE ///
114  ////////////////////
115  static void setScriptManager(ScriptManager* scriptManager) { State::scriptManager = scriptManager; };
116  static ScriptManager* getScriptManager() { return State::scriptManager; };
117
118  ////////////
119  /// Menu ///
120  ////////////
121  /** sets the menu mode @param mode true if always exit to menu */
122  static inline void setMenuID(int menuID) { State::menuID = menuID; }
123  /** @returns the menu mode */
124  static inline int getMenuID() { return State::menuID;}
125
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; }
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; }
138
139
140 private:
141  State();
142
143  static Camera*                camera;             //!< The current Camera.
144  static CameraTarget*          cameraTarget;       //!< The Camera Target.
145  static CameraMan*             cameraManager;
146  static PNode*                 cameraNode;         //!< A reference to the camera
147  static PNode*                 cameraTargetNode;   //!< A reference to the cameraTarget
148  static PNode*                 nullParent;         //!< A reference to the Null-PNode.
149  static ObjectManager*         objectManager;      //!< A reference to the current ObjectManager
150  static StoryEntity*           storyEntity;        //!< A reference to the current StoryEntity played
151  static GameRules*             gameRules;          //!< A reference to the GameRules
152  static Player*                player;             //!< A reference to the Player
153  static PNode*                 travelNode;         //!< A reference to the scroller-travelnode
154  static ActionBox*             actionBox;          //!< A reference to the action box
155
156  static SkyBox*                skyBox;            //!< The SkyBox used in the current world.
157
158  static  ScriptManager*        scriptManager;     //!< The ScriptManager.
159
160  static unsigned int           resX;              //!< The X Resolution of the screen.
161  static unsigned int           resY;              //!< The Y Resolution of the screen.
162  static int                    menuID;            //!< -1 on default, otherwise orxonox's Menu ID
163  static bool                   bOnline;           //!< Is true if this node is in multiplayer mode (via network)
164 
165  static bool                   bWireframe;        //!< The Wireframemode
166  };
167
168#endif /* _STATE_H */
Note: See TracBrowser for help on using the repository browser.