Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7014 was 7014, checked in by bensch, 18 years ago

trunk: new algorithm for the Camera-Distance

File size: 4.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;
19
20
21//! handles states about orxonox's most importatn objects
22/**
23 * This is an abstract Class-container, not really a Class.
24 * in this Class only static references to the most important
25 * Objects/List/etc. are stored.
26 */
27class State {
28
29 public:
30   //////////////
31   /// CAMERA ///
32   //////////////
33  /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */
34  static void setCamera(Camera* camera, CameraTarget* cameraTarget);
35  static inline Camera* getCamera() { return State::camera; };
36  static inline CameraTarget* getCameraTarget() { return State::cameraTarget; };
37  /** @returns a Pointer to the PNode of the Camera */
38  static inline PNode* getCameraNode() { return State::cameraNode; };
39  /** @returns a Pointer to the CameraTarget */
40  static inline PNode* getCameraTargetNode() { return State::cameraTargetNode; };
41
42  ////////////////
43  /// SKYBOX   ///
44  ////////////////
45  /** @returns the current SkyBox */
46  static inline SkyBox* getSkyBox() { return State::skyBox; };
47  /** @param skyBox the SkyBox */
48  static inline SkyBox* setSkyBox(SkyBox* skyBox) { State::skyBox = skyBox; };
49
50  //////////////////////
51  /// OBJECT-MANAGER ///
52  //////////////////////
53  /** @param objectManager the new Current ObjectManager */
54  static inline void setObjectManager(ObjectManager* objectManager) { State::objectManager = objectManager; };
55  /** @returns the current ObjectManager. */
56  static inline ObjectManager* getObjectManager() { return State::objectManager; };
57
58  static inline void setResolution(unsigned int resX, unsigned int resY) { State::resX = resX; State::resY = resY; };
59  static inline unsigned int getResX() { return State::resX; };
60  static inline unsigned int getResY() { return State::resY; };
61
62  //////////////////////
63  /// STORY-ENTITY   ///
64  //////////////////////
65  /** @param storyEntity sets the current StoryEntity that is been played */
66  static inline void setCurrentStoryEntity(StoryEntity* storyEntity) { State::storyEntity = storyEntity; };
67  /** @returns the current StoryEntity played */
68  static inline StoryEntity* getCurrentStoryEntity() { return State::storyEntity; };
69
70  //////////////
71  /// PLAYER ///
72  //////////////
73  /** @param player sets the current local player */
74  static inline void setPlayer(Player* player) { State::player = player; };
75  /** @returns the local player*/
76  static inline Player* getPlayer() { return State::player; };
77
78
79  ///////////////
80  /// NETWORK ///
81  ///////////////
82  /** sets the online stat (multiplayer network) @param bOnline is true if node is online */
83  static inline void setOnline(bool bOnline) { State::bOnline = bOnline; }
84  /** @returns true if this node is online (multiplayer network game) */
85  static bool isOnline() { return State::bOnline; }
86
87
88  ////////////
89  /// Menu ///
90  ////////////
91  /** sets the menu mode @param mode true if always exit to menu */
92  static inline void setMenuMode(bool mode) { State::bMenuMode = mode; }
93  /** @returns the menu mode */
94  static inline bool getMenuMode() { return State::bMenuMode;}
95
96
97
98 private:
99  State();
100
101  static Camera*                camera;             //!< The current Camera.
102  static CameraTarget*          cameraTarget;       //!< The Camera Target.
103  static PNode*                 cameraNode;         //!< A reference to the camera
104  static PNode*                 cameraTargetNode;   //!< A reference to the cameraTarget
105  static PNode*                 nullParent;         //!< A reference to the Null-PNode.
106  static ObjectManager*         objectManager;      //!< A reference to the current ObjectManager
107  static StoryEntity*           storyEntity;        //!< A reference to the current StoryEntity played
108  static Player*                player;             //!< A reference to the Player
109
110  static SkyBox*                skyBox;            //!< The SkyBox used in the current world.
111  static unsigned int           resX;              //!< The X Resolution of the screen.
112  static unsigned int           resY;              //!< The Y Resolution of the screen.
113
114  static bool                   bOnline;           //!< Is true if this node is in multiplayer mode (via network)
115  static bool                   bMenuMode;         //!< True is orxonox is player in the menu mode (always returning to the menu after exit)
116
117  };
118
119#endif /* _STATE_H */
Note: See TracBrowser for help on using the repository browser.