Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/vs-enhencements/src/util/state.h @ 10642

Last change on this file since 10642 was 10642, checked in by rennerc, 18 years ago

implemented action box

File size: 6.3 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
97
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; }
105
106
107
108  ////////////////////
109  /// SCRIPT_ENGINE ///
110  ////////////////////
111  static void setScriptManager(ScriptManager* scriptManager) { State::scriptManager = scriptManager; };
112  static ScriptManager* getScriptManager() { return State::scriptManager; };
113
114  ////////////
115  /// Menu ///
116  ////////////
117  /** sets the menu mode @param mode true if always exit to menu */
118  static inline void setMenuID(int menuID) { State::menuID = menuID; }
119  /** @returns the menu mode */
120  static inline int getMenuID() { return State::menuID;}
121
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; }
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; }
134
135
136 private:
137  State();
138
139  static Camera*                camera;             //!< The current Camera.
140  static CameraTarget*          cameraTarget;       //!< The Camera Target.
141  static CameraMan*             cameraManager;
142  static PNode*                 cameraNode;         //!< A reference to the camera
143  static PNode*                 cameraTargetNode;   //!< A reference to the cameraTarget
144  static PNode*                 nullParent;         //!< A reference to the Null-PNode.
145  static ObjectManager*         objectManager;      //!< A reference to the current ObjectManager
146  static StoryEntity*           storyEntity;        //!< A reference to the current StoryEntity played
147  static GameRules*             gameRules;          //!< A reference to the GameRules
148  static Player*                player;             //!< A reference to the Player
149  static PNode*                 travelNode;         //!< A reference to the scroller-travelnode
150  static ActionBox*             actionBox;          //!< A reference to the action box
151
152  static SkyBox*                skyBox;            //!< The SkyBox used in the current world.
153
154  static  ScriptManager*        scriptManager;     //!< The ScriptManager.
155
156  static unsigned int           resX;              //!< The X Resolution of the screen.
157  static unsigned int           resY;              //!< The Y Resolution of the screen.
158  static int                    menuID;            //!< -1 on default, otherwise orxonox's Menu ID
159  static bool                   bOnline;           //!< Is true if this node is in multiplayer mode (via network)
160  };
161
162#endif /* _STATE_H */
Note: See TracBrowser for help on using the repository browser.