[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" |
---|
| 34 | #include "OgreTextureManager.h" |
---|
[232] | 35 | #include "OgreSingleton.h" |
---|
[169] | 36 | |
---|
| 37 | #include <OIS/OISPrereqs.h> |
---|
| 38 | |
---|
| 39 | #include "orxonox_prerequisites.h" |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | namespace orxonox { |
---|
| 43 | |
---|
| 44 | // let the class inherit from WindowEventListener in order for the RunMgr |
---|
| 45 | // to act as the central point of all the calcuations in Orxonox |
---|
[232] | 46 | class RunManager : public Ogre::WindowEventListener, |
---|
| 47 | public Ogre::Singleton<RunManager> |
---|
[169] | 48 | { |
---|
| 49 | public: |
---|
[232] | 50 | RunManager(OgreControl*); |
---|
[169] | 51 | |
---|
[232] | 52 | virtual ~RunManager(); |
---|
| 53 | //void initialise(OgreControl*); |
---|
[169] | 54 | |
---|
[232] | 55 | bool tick(unsigned long, Ogre::Real); |
---|
[169] | 56 | |
---|
[232] | 57 | Ogre::SceneManager& getSceneManager(); |
---|
| 58 | |
---|
| 59 | Ogre::SceneManager* getSceneManagerPtr(); |
---|
| 60 | |
---|
| 61 | weapon::BulletManager* getBulletManagerPtr(); |
---|
| 62 | |
---|
| 63 | int getAmmunitionID(const Ogre::String&); |
---|
| 64 | |
---|
| 65 | int getNumberOfAmmos(); |
---|
| 66 | |
---|
| 67 | static RunManager& getSingleton(void); |
---|
| 68 | |
---|
| 69 | static RunManager* getSingletonPtr(void); |
---|
| 70 | |
---|
| 71 | |
---|
[169] | 72 | protected: |
---|
[232] | 73 | void createCamera(void); |
---|
[169] | 74 | |
---|
[232] | 75 | void createViewports(void); |
---|
[169] | 76 | |
---|
| 77 | |
---|
| 78 | /** EVENT HANDLING **/ |
---|
| 79 | |
---|
| 80 | //Adjust mouse clipping area |
---|
[232] | 81 | void windowResized(Ogre::RenderWindow*); |
---|
[169] | 82 | |
---|
| 83 | //Unattach OIS before window shutdown (very important under Linux) |
---|
[232] | 84 | void windowClosed(Ogre::RenderWindow*); |
---|
[169] | 85 | |
---|
| 86 | |
---|
| 87 | /** INPUT PROCESSING **/ |
---|
[232] | 88 | bool processUnbufferedKeyInput(); |
---|
[169] | 89 | |
---|
[232] | 90 | bool processUnbufferedMouseInput(); |
---|
[169] | 91 | |
---|
| 92 | |
---|
| 93 | /** OUTPUT **/ |
---|
| 94 | |
---|
[232] | 95 | void updateStats(void); |
---|
[169] | 96 | |
---|
[232] | 97 | void showDebugOverlay(bool); |
---|
[169] | 98 | |
---|
| 99 | protected: |
---|
| 100 | Ogre::SceneManager *sceneMgr_; |
---|
| 101 | Ogre::RenderWindow *window_; |
---|
| 102 | Ogre::Camera *camera_; |
---|
| 103 | OgreControl *ogre_; |
---|
| 104 | OrxonoxScene *backgroundScene_; |
---|
| 105 | OrxonoxShip *playerShip_; |
---|
| 106 | |
---|
| 107 | bool statsOn_; |
---|
| 108 | std::string debugText_; |
---|
| 109 | |
---|
| 110 | unsigned int screenShotCounter_; |
---|
| 111 | // just to stop toggles flipping too fast |
---|
| 112 | Ogre::Real timeUntilNextToggle_; |
---|
[194] | 113 | //bool leftButtonDown_; |
---|
[169] | 114 | Ogre::TextureFilterOptions filtering_; |
---|
| 115 | int aniso_; |
---|
| 116 | |
---|
| 117 | int sceneDetailIndex_; |
---|
| 118 | Ogre::Overlay* debugOverlay_; |
---|
| 119 | |
---|
| 120 | //OIS Input devices |
---|
| 121 | OIS::InputManager* inputManager_; |
---|
| 122 | OIS::Mouse* mouse_; |
---|
| 123 | OIS::Keyboard* keyboard_; |
---|
| 124 | OIS::JoyStick* joystick_; |
---|
| 125 | |
---|
| 126 | const Ogre::Real mouseSensitivity_; |
---|
| 127 | |
---|
| 128 | // Bullet array |
---|
[177] | 129 | /*Bullet **bullets_; |
---|
[169] | 130 | int bulletsSize_; |
---|
[177] | 131 | int bulletsIndex_;*/ |
---|
[189] | 132 | weapon::BulletManager *bulletManager_; |
---|
[169] | 133 | |
---|
| 134 | // previously elapsed render time |
---|
| 135 | unsigned long totalTime_; |
---|
| 136 | |
---|
| 137 | }; |
---|
| 138 | |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | #endif /* RUN_MANAGER_H */ |
---|