Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

trunk: the menu control better implemented

File size: 4.1 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;
[4827]12class WorldEntity;
[6498]13class Player;
14class SkyBox;
15class StoryEntity;
[6142]16class ObjectManager;
[3655]17
[6468]18
[5405]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 {
[3655]26
27 public:
[6142]28   //////////////
29   /// CAMERA ///
30   //////////////
[4827]31  /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */
[6222]32  static void setCamera(PNode* camera, PNode* cameraTarget);
[4827]33  /** @returns a Pointer to the PNode of the Camera */
[6222]34  static inline PNode* getCamera() { return State::camera; };
[4827]35  /** @returns a Pointer to the CameraTarget */
[6222]36  static inline PNode* getCameraTarget() { return State::cameraTarget; };
[4485]37
[6498]38  ////////////////
39  /// SKYBOX   ///
40  ////////////////
[6468]41  /** @returns the current SkyBox */
[6498]42  static inline SkyBox* getSkyBox() { return State::skyBox; };
[6468]43  /** @param skyBox the SkyBox */
[6498]44  static inline SkyBox* setSkyBox(SkyBox* skyBox) { State::skyBox = skyBox; };
[6468]45
[6142]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; };
[3655]53
[6498]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; };
[6468]57
[6498]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; };
[6441]65
[6498]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; };
[6142]73
[6498]74
[6695]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; }
[6498]82
[6695]83
[6874]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
[3655]94 private:
[4746]95  State();
[4293]96
[6222]97  static PNode*                 camera;             //!< A reference to the camera
98  static PNode*                 cameraTarget;       //!< A reference to the cameraTarget
[5405]99  static PNode*                 nullParent;         //!< A reference to the Null-PNode.
[6498]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
[4827]103
[6498]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.
[6695]107
108  static bool                   bOnline;           //!< Is true if this node is in multiplayer mode (via network)
[6874]109  static bool                   bMenuMode;         //!< True is orxonox is player in the menu mode (always returning to the menu after exit)
[6695]110
[6468]111  };
[3655]112
[4293]113#endif /* _STATE_H */
Note: See TracBrowser for help on using the repository browser.