1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * |
---|
4 | * |
---|
5 | * License notice: |
---|
6 | * |
---|
7 | * This program is free software: you can redistribute it and/or modify |
---|
8 | * it under the terms of the GNU General Public License as published by |
---|
9 | * the Free Software Foundation, either version 3 of the License, or |
---|
10 | * (at your option) any later version. |
---|
11 | * |
---|
12 | * This program is distributed in the hope that it will be useful, |
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | * GNU General Public License for more details. |
---|
16 | * |
---|
17 | * You should have received a copy of the GNU General Public License |
---|
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
19 | * |
---|
20 | * |
---|
21 | * Author: |
---|
22 | * Reto Grieder |
---|
23 | * Co-authors: |
---|
24 | * ... |
---|
25 | * |
---|
26 | */ |
---|
27 | |
---|
28 | |
---|
29 | #ifndef RUN_MANAGER_H |
---|
30 | #define RUN_MANAGER_H |
---|
31 | |
---|
32 | #include "OgrePrerequisites.h" |
---|
33 | #include "OgreWindowEventUtilities.h" |
---|
34 | //#include "OgreTextureManager.h" |
---|
35 | |
---|
36 | #include <OIS/OISPrereqs.h> |
---|
37 | |
---|
38 | #include "orxonox_prerequisites.h" |
---|
39 | |
---|
40 | |
---|
41 | namespace orxonox { |
---|
42 | |
---|
43 | // let the class inherit from WindowEventListener in order for the RunMgr |
---|
44 | // to act as the central point of all the calcuations in Orxonox |
---|
45 | class RunManager : public Ogre::WindowEventListener |
---|
46 | { |
---|
47 | public: |
---|
48 | virtual ~RunManager(); |
---|
49 | |
---|
50 | void initialise(OgreControl*); |
---|
51 | |
---|
52 | bool tick(unsigned long, Ogre::Real); |
---|
53 | |
---|
54 | Ogre::SceneManager& getSceneManager(); |
---|
55 | |
---|
56 | Ogre::SceneManager* getSceneManagerPtr(); |
---|
57 | |
---|
58 | weapon::BulletManager* getBulletManagerPtr(); |
---|
59 | |
---|
60 | int getAmmunitionID(const Ogre::String&); |
---|
61 | |
---|
62 | int getNumberOfAmmos(); |
---|
63 | |
---|
64 | static RunManager* createSingleton(); |
---|
65 | |
---|
66 | static void destroySingleton(); |
---|
67 | |
---|
68 | static RunManager& getSingleton(void); |
---|
69 | |
---|
70 | static RunManager* getSingletonPtr(void); |
---|
71 | |
---|
72 | |
---|
73 | protected: |
---|
74 | RunManager(); |
---|
75 | |
---|
76 | void createCamera(void); |
---|
77 | |
---|
78 | void createViewports(void); |
---|
79 | |
---|
80 | |
---|
81 | /** EVENT HANDLING **/ |
---|
82 | |
---|
83 | //Adjust mouse clipping area |
---|
84 | void windowResized(Ogre::RenderWindow*); |
---|
85 | |
---|
86 | //Unattach OIS before window shutdown (very important under Linux) |
---|
87 | void windowClosed(Ogre::RenderWindow*); |
---|
88 | |
---|
89 | |
---|
90 | /** INPUT PROCESSING **/ |
---|
91 | bool processUnbufferedKeyInput(); |
---|
92 | |
---|
93 | bool processUnbufferedMouseInput(); |
---|
94 | |
---|
95 | |
---|
96 | /** OUTPUT **/ |
---|
97 | |
---|
98 | void showDebugOverlay(bool); |
---|
99 | |
---|
100 | protected: |
---|
101 | // directly Ogre related fields |
---|
102 | Ogre::SceneManager *sceneMgr_; |
---|
103 | Ogre::RenderWindow *window_; |
---|
104 | Ogre::Camera *camera_; |
---|
105 | |
---|
106 | |
---|
107 | // self made orxonox fields |
---|
108 | OgreControl *ogre_; |
---|
109 | OrxonoxScene *backgroundScene_; |
---|
110 | OrxonoxShip *playerShip_; |
---|
111 | hud::TestOverlay *hud_; |
---|
112 | |
---|
113 | // Bullet manager |
---|
114 | weapon::BulletManager *bulletManager_; |
---|
115 | |
---|
116 | const Ogre::Real mouseSensitivity_; |
---|
117 | |
---|
118 | // previously elapsed render time |
---|
119 | unsigned long totalTime_; |
---|
120 | |
---|
121 | |
---|
122 | // fields from the example framework |
---|
123 | bool statsOn_; |
---|
124 | |
---|
125 | unsigned int screenShotCounter_; |
---|
126 | // just to stop toggles flipping too fast |
---|
127 | Ogre::Real timeUntilNextToggle_; |
---|
128 | |
---|
129 | //OIS Input devices |
---|
130 | OIS::InputManager* inputManager_; |
---|
131 | OIS::Mouse* mouse_; |
---|
132 | OIS::Keyboard* keyboard_; |
---|
133 | OIS::JoyStick* joystick_; |
---|
134 | |
---|
135 | // singleton pointer |
---|
136 | static RunManager *singletonPtr_s; |
---|
137 | |
---|
138 | }; |
---|
139 | |
---|
140 | } |
---|
141 | |
---|
142 | #endif /* RUN_MANAGER_H */ |
---|