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