Last change
on this file since 4828 was
4827,
checked in by bensch, 19 years ago
|
orxonox/trunk: state is no more singleton, but static class.
This is faster, and easier to handle, because one can just say State::getBLA() and not State::getInstance()→getBLA(); ——→>> less redundant
|
File size:
1.4 KB
|
Line | |
---|
1 | /*! |
---|
2 | \file state.h |
---|
3 | \brief Definition of the States-singleton Class |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _STATE_H |
---|
7 | #define _STATE_H |
---|
8 | |
---|
9 | #include "base_object.h" |
---|
10 | |
---|
11 | // FORWARD DEFINITION |
---|
12 | class PNode; |
---|
13 | class WorldEntity; |
---|
14 | template<class T> class tList; |
---|
15 | |
---|
16 | //! A Singleton class, that handles some states about orxonox's objects |
---|
17 | class State : public BaseObject { |
---|
18 | |
---|
19 | public: |
---|
20 | // CAMERA // |
---|
21 | /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */ |
---|
22 | static void setCamera(const PNode* camera, const PNode* cameraTarget); |
---|
23 | /** @returns a Pointer to the PNode of the Camera */ |
---|
24 | static inline const PNode* getCamera() { return State::camera; }; |
---|
25 | /** @returns a Pointer to the CameraTarget */ |
---|
26 | static inline const PNode* getCameraTarget() { return State::cameraTarget; }; |
---|
27 | |
---|
28 | // WORLD_ENTITY_LIST // |
---|
29 | /** @param worldEntityList The World's List of WorldEntities */ |
---|
30 | static inline void setWorldEntityList(tList<WorldEntity>* worldEntityList) { State::worldEntityList = worldEntityList; }; |
---|
31 | /** @returns the List of WorldEntities */ |
---|
32 | static inline tList<WorldEntity>* getWorldEntityList() { return State::worldEntityList; }; |
---|
33 | |
---|
34 | private: |
---|
35 | State(); |
---|
36 | |
---|
37 | static const PNode* camera; //!< A reference to the camera |
---|
38 | static const PNode* cameraTarget; //!< a reference to the cameraTarget |
---|
39 | |
---|
40 | static tList<WorldEntity>* worldEntityList; //!< The List of the worldEntities |
---|
41 | }; |
---|
42 | |
---|
43 | #endif /* _STATE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.