Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7036 was 7032, checked in by bensch, 19 years ago

testing

File size: 4.4 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;
[3655]19
[6468]20
[5405]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 {
[3655]28
29 public:
[6142]30   //////////////
31   /// CAMERA ///
32   //////////////
[4827]33  /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */
[7014]34  static void setCamera(Camera* camera, CameraTarget* cameraTarget);
35  static inline Camera* getCamera() { return State::camera; };
36  static inline CameraTarget* getCameraTarget() { return State::cameraTarget; };
[4827]37  /** @returns a Pointer to the PNode of the Camera */
[7014]38  static inline PNode* getCameraNode() { return State::cameraNode; };
[4827]39  /** @returns a Pointer to the CameraTarget */
[7014]40  static inline PNode* getCameraTargetNode() { return State::cameraTargetNode; };
[4485]41
[6498]42  ////////////////
43  /// SKYBOX   ///
44  ////////////////
[6468]45  /** @returns the current SkyBox */
[6498]46  static inline SkyBox* getSkyBox() { return State::skyBox; };
[6468]47  /** @param skyBox the SkyBox */
[6498]48  static inline SkyBox* setSkyBox(SkyBox* skyBox) { State::skyBox = skyBox; };
[6468]49
[6142]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; };
[3655]57
[6498]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; };
[6468]61
[6498]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; };
[6441]69
[6498]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; };
[6142]77
[6498]78
[6695]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; }
[6498]86
[6695]87
[6874]88  ////////////
89  /// Menu ///
90  ////////////
91  /** sets the menu mode @param mode true if always exit to menu */
[7032]92  static inline void setMenuID(int menuID) { State::menuID = menuID; }
[6874]93  /** @returns the menu mode */
[7032]94  static inline int getMenuID() { return State::menuID;}
[6874]95
96
97
[3655]98 private:
[4746]99  State();
[4293]100
[7014]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
[5405]105  static PNode*                 nullParent;         //!< A reference to the Null-PNode.
[6498]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
[4827]109
[6498]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.
[7032]113  static int                    menuID;            //!< -1 on default, otherwise orxonox's Menu ID
[6695]114  static bool                   bOnline;           //!< Is true if this node is in multiplayer mode (via network)
[6468]115  };
[3655]116
[4293]117#endif /* _STATE_H */
Note: See TracBrowser for help on using the repository browser.