Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10546 was 10379, checked in by patrick, 18 years ago

merged branche camera to trunk. resolved many conflicts as in the other projects too

File size: 5.9 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;
22
23
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 */
30class State {
31
32 public:
33   //////////////
34   /// CAMERA ///
35   //////////////
36  /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */
37  static void setCamera(Camera* camera, CameraTarget* cameraTarget);
38  static inline Camera* getCamera() { return State::camera; };
39  static inline CameraTarget* getCameraTarget() { return State::cameraTarget; };
40  /** @returns a Pointer to the PNode of the Camera */
41  static inline PNode* getCameraNode() { return State::cameraNode; };
42  /** @returns a Pointer to the CameraTarget */
43  static inline PNode* getCameraTargetNode() { return State::cameraTargetNode; };
44
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
55  ////////////////
56  /// SKYBOX   ///
57  ////////////////
58  /** @returns the current SkyBox */
59  static inline SkyBox* getSkyBox() { return State::skyBox; };
60  /** @param skyBox the SkyBox */
61  static inline void setSkyBox(SkyBox* skyBox) { State::skyBox = skyBox; };
62
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; };
70
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; };
74
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; };
82
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
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; };
95
96
97  ///////////////
98  /// NETWORK ///
99  ///////////////
100  /** sets the online stat (multiplayer network) @param bOnline is true if node is online */
101  static inline void setOnline(bool bOnline) { State::bOnline = bOnline; }
102  /** @returns true if this node is online (multiplayer network game) */
103  static bool isOnline() { return State::bOnline; }
104
105
106
107  ////////////////////
108  /// SCRIPT_ENGINE ///
109  ////////////////////
110  static void setScriptManager(ScriptManager* scriptManager) { State::scriptManager = scriptManager; };
111  static ScriptManager* getScriptManager() { return State::scriptManager; };
112
113  ////////////
114  /// Menu ///
115  ////////////
116  /** sets the menu mode @param mode true if always exit to menu */
117  static inline void setMenuID(int menuID) { State::menuID = menuID; }
118  /** @returns the menu mode */
119  static inline int getMenuID() { return State::menuID;}
120
121  ////////////////////////
122  /// Scroller-Control ///
123  ////////////////////////
124  /** sets the scroller-travelnode (center of the screen) */
125  static void setTravelNode(PNode* travelNode) {State::travelNode = travelNode;}
126  /** @returns the scroller-travelnode (center of the screen) */
127  static PNode* getTravelNode() { return State::travelNode; }
128
129
130 private:
131  State();
132
133  static Camera*                camera;             //!< The current Camera.
134  static CameraTarget*          cameraTarget;       //!< The Camera Target.
135  static CameraMan*             cameraManager;
136  static PNode*                 cameraNode;         //!< A reference to the camera
137  static PNode*                 cameraTargetNode;   //!< A reference to the cameraTarget
138  static PNode*                 nullParent;         //!< A reference to the Null-PNode.
139  static ObjectManager*         objectManager;      //!< A reference to the current ObjectManager
140  static StoryEntity*           storyEntity;        //!< A reference to the current StoryEntity played
141  static GameRules*             gameRules;          //!< A reference to the GameRules
142  static Player*                player;             //!< A reference to the Player
143  static PNode*                 travelNode;         //!< A reference to the scroller-travelnode
144
145  static SkyBox*                skyBox;            //!< The SkyBox used in the current world.
146
147  static  ScriptManager*        scriptManager;     //!< The ScriptManager.
148
149  static unsigned int           resX;              //!< The X Resolution of the screen.
150  static unsigned int           resY;              //!< The Y Resolution of the screen.
151  static int                    menuID;            //!< -1 on default, otherwise orxonox's Menu ID
152  static bool                   bOnline;           //!< Is true if this node is in multiplayer mode (via network)
153  };
154
155#endif /* _STATE_H */
Note: See TracBrowser for help on using the repository browser.