Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/cdmerge/src/util/state.h @ 6926

Last change on this file since 6926 was 6874, checked in by patrick, 19 years ago

trunk: the menu control better implemented

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