[190] | 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" |
---|
[289] | 34 | //#include "OgreTextureManager.h" |
---|
[190] | 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 |
---|
[289] | 45 | class RunManager : public Ogre::WindowEventListener |
---|
[190] | 46 | { |
---|
| 47 | public: |
---|
[267] | 48 | virtual ~RunManager(); |
---|
[289] | 49 | |
---|
| 50 | void initialise(OgreControl*); |
---|
[190] | 51 | |
---|
[267] | 52 | bool tick(unsigned long, Ogre::Real); |
---|
[190] | 53 | |
---|
[267] | 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 | |
---|
[289] | 64 | static RunManager* createSingleton(); |
---|
| 65 | |
---|
| 66 | static void destroySingleton(); |
---|
| 67 | |
---|
[267] | 68 | static RunManager& getSingleton(void); |
---|
| 69 | |
---|
| 70 | static RunManager* getSingletonPtr(void); |
---|
| 71 | |
---|
| 72 | |
---|
[190] | 73 | protected: |
---|
[289] | 74 | RunManager(); |
---|
| 75 | |
---|
[267] | 76 | void createCamera(void); |
---|
[190] | 77 | |
---|
[267] | 78 | void createViewports(void); |
---|
[190] | 79 | |
---|
| 80 | |
---|
| 81 | /** EVENT HANDLING **/ |
---|
| 82 | |
---|
| 83 | //Adjust mouse clipping area |
---|
[267] | 84 | void windowResized(Ogre::RenderWindow*); |
---|
[190] | 85 | |
---|
| 86 | //Unattach OIS before window shutdown (very important under Linux) |
---|
[267] | 87 | void windowClosed(Ogre::RenderWindow*); |
---|
[190] | 88 | |
---|
| 89 | |
---|
| 90 | /** INPUT PROCESSING **/ |
---|
[267] | 91 | bool processUnbufferedKeyInput(); |
---|
[190] | 92 | |
---|
[267] | 93 | bool processUnbufferedMouseInput(); |
---|
[190] | 94 | |
---|
| 95 | |
---|
| 96 | /** OUTPUT **/ |
---|
| 97 | |
---|
[267] | 98 | void showDebugOverlay(bool); |
---|
[190] | 99 | |
---|
| 100 | protected: |
---|
[267] | 101 | // directly Ogre related fields |
---|
[190] | 102 | Ogre::SceneManager *sceneMgr_; |
---|
| 103 | Ogre::RenderWindow *window_; |
---|
| 104 | Ogre::Camera *camera_; |
---|
[267] | 105 | |
---|
| 106 | |
---|
| 107 | // self made orxonox fields |
---|
[190] | 108 | OgreControl *ogre_; |
---|
| 109 | OrxonoxScene *backgroundScene_; |
---|
| 110 | OrxonoxShip *playerShip_; |
---|
[289] | 111 | hud::TestOverlay *hud_; |
---|
[190] | 112 | |
---|
[267] | 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 |
---|
[190] | 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 | |
---|
[289] | 135 | // singleton pointer |
---|
| 136 | static RunManager *singletonPtr_s; |
---|
| 137 | |
---|
[190] | 138 | }; |
---|
| 139 | |
---|
| 140 | } |
---|
| 141 | |
---|
| 142 | #endif /* RUN_MANAGER_H */ |
---|