Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7305 was 7039, checked in by patrick, 19 years ago

trunk: game rules definitions added

File size: 4.8 KB
RevLine 
[4597]1/*!
[5039]2 * @file state.h
[5405]3 * Definition of the States Class
[3655]4*/
5
[4293]6#ifndef _STATE_H
7#define _STATE_H
[3655]8
[6498]9
[5405]10// FORWARD DECLARATION
[4293]11class PNode;
[7014]12class Camera;
13class CameraTarget;
[4827]14class WorldEntity;
[6498]15class Player;
16class SkyBox;
17class StoryEntity;
[6142]18class ObjectManager;
[7039]19class GameRules;
[3655]20
[6468]21
[5405]22//! handles states about orxonox's most importatn objects
23/**
24 * This is an abstract Class-container, not really a Class.
25 * in this Class only static references to the most important
26 * Objects/List/etc. are stored.
27 */
28class State {
[3655]29
30 public:
[6142]31   //////////////
32   /// CAMERA ///
33   //////////////
[4827]34  /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */
[7014]35  static void setCamera(Camera* camera, CameraTarget* cameraTarget);
36  static inline Camera* getCamera() { return State::camera; };
37  static inline CameraTarget* getCameraTarget() { return State::cameraTarget; };
[4827]38  /** @returns a Pointer to the PNode of the Camera */
[7014]39  static inline PNode* getCameraNode() { return State::cameraNode; };
[4827]40  /** @returns a Pointer to the CameraTarget */
[7014]41  static inline PNode* getCameraTargetNode() { return State::cameraTargetNode; };
[4485]42
[6498]43  ////////////////
44  /// SKYBOX   ///
45  ////////////////
[6468]46  /** @returns the current SkyBox */
[6498]47  static inline SkyBox* getSkyBox() { return State::skyBox; };
[6468]48  /** @param skyBox the SkyBox */
[6498]49  static inline SkyBox* setSkyBox(SkyBox* skyBox) { State::skyBox = skyBox; };
[6468]50
[6142]51  //////////////////////
52  /// OBJECT-MANAGER ///
53  //////////////////////
54  /** @param objectManager the new Current ObjectManager */
55  static inline void setObjectManager(ObjectManager* objectManager) { State::objectManager = objectManager; };
56  /** @returns the current ObjectManager. */
57  static inline ObjectManager* getObjectManager() { return State::objectManager; };
[3655]58
[6498]59  static inline void setResolution(unsigned int resX, unsigned int resY) { State::resX = resX; State::resY = resY; };
60  static inline unsigned int getResX() { return State::resX; };
61  static inline unsigned int getResY() { return State::resY; };
[6468]62
[6498]63  //////////////////////
64  /// STORY-ENTITY   ///
65  //////////////////////
66  /** @param storyEntity sets the current StoryEntity that is been played */
67  static inline void setCurrentStoryEntity(StoryEntity* storyEntity) { State::storyEntity = storyEntity; };
68  /** @returns the current StoryEntity played */
69  static inline StoryEntity* getCurrentStoryEntity() { return State::storyEntity; };
[6441]70
[7039]71  /** @param gameRules sets the current GameRules */
72  static inline void setGameRules(GameRules* gameRules) { State::gameRules = gameRules; }
73  /** @returns the GameRules reference*/
74  static inline GameRules* getGameRules() { return State::gameRules; }
75
[6498]76  //////////////
77  /// PLAYER ///
78  //////////////
79  /** @param player sets the current local player */
80  static inline void setPlayer(Player* player) { State::player = player; };
81  /** @returns the local player*/
82  static inline Player* getPlayer() { return State::player; };
[6142]83
[6498]84
[6695]85  ///////////////
86  /// NETWORK ///
87  ///////////////
88  /** sets the online stat (multiplayer network) @param bOnline is true if node is online */
89  static inline void setOnline(bool bOnline) { State::bOnline = bOnline; }
90  /** @returns true if this node is online (multiplayer network game) */
91  static bool isOnline() { return State::bOnline; }
[6498]92
[6695]93
[6874]94  ////////////
95  /// Menu ///
96  ////////////
97  /** sets the menu mode @param mode true if always exit to menu */
[7032]98  static inline void setMenuID(int menuID) { State::menuID = menuID; }
[6874]99  /** @returns the menu mode */
[7032]100  static inline int getMenuID() { return State::menuID;}
[6874]101
102
103
[3655]104 private:
[4746]105  State();
[4293]106
[7014]107  static Camera*                camera;             //!< The current Camera.
108  static CameraTarget*          cameraTarget;       //!< The Camera Target.
109  static PNode*                 cameraNode;         //!< A reference to the camera
110  static PNode*                 cameraTargetNode;   //!< A reference to the cameraTarget
[5405]111  static PNode*                 nullParent;         //!< A reference to the Null-PNode.
[6498]112  static ObjectManager*         objectManager;      //!< A reference to the current ObjectManager
113  static StoryEntity*           storyEntity;        //!< A reference to the current StoryEntity played
[7039]114  static GameRules*             gameRules;          //!< A reference to the GameRules
[6498]115  static Player*                player;             //!< A reference to the Player
[4827]116
[6498]117  static SkyBox*                skyBox;            //!< The SkyBox used in the current world.
118  static unsigned int           resX;              //!< The X Resolution of the screen.
119  static unsigned int           resY;              //!< The Y Resolution of the screen.
[7032]120  static int                    menuID;            //!< -1 on default, otherwise orxonox's Menu ID
[6695]121  static bool                   bOnline;           //!< Is true if this node is in multiplayer mode (via network)
[6468]122  };
[3655]123
[4293]124#endif /* _STATE_H */
Note: See TracBrowser for help on using the repository browser.