| 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 | #include "OgreSingleton.h" | 
|---|
| 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 | 
|---|
| 46 | class RunManager : public Ogre::WindowEventListener, | 
|---|
| 47 | public Ogre::Singleton<RunManager> | 
|---|
| 48 | { | 
|---|
| 49 | public: | 
|---|
| 50 | RunManager(OgreControl*); | 
|---|
| 51 |  | 
|---|
| 52 | virtual ~RunManager(); | 
|---|
| 53 | //void initialise(OgreControl*); | 
|---|
| 54 |  | 
|---|
| 55 | bool tick(unsigned long, Ogre::Real); | 
|---|
| 56 |  | 
|---|
| 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 |  | 
|---|
| 72 | protected: | 
|---|
| 73 | void createCamera(void); | 
|---|
| 74 |  | 
|---|
| 75 | void createViewports(void); | 
|---|
| 76 |  | 
|---|
| 77 |  | 
|---|
| 78 | /** EVENT HANDLING **/ | 
|---|
| 79 |  | 
|---|
| 80 | //Adjust mouse clipping area | 
|---|
| 81 | void windowResized(Ogre::RenderWindow*); | 
|---|
| 82 |  | 
|---|
| 83 | //Unattach OIS before window shutdown (very important under Linux) | 
|---|
| 84 | void windowClosed(Ogre::RenderWindow*); | 
|---|
| 85 |  | 
|---|
| 86 |  | 
|---|
| 87 | /** INPUT PROCESSING **/ | 
|---|
| 88 | bool processUnbufferedKeyInput(); | 
|---|
| 89 |  | 
|---|
| 90 | bool processUnbufferedMouseInput(); | 
|---|
| 91 |  | 
|---|
| 92 |  | 
|---|
| 93 | /** OUTPUT **/ | 
|---|
| 94 |  | 
|---|
| 95 | void updateStats(void); | 
|---|
| 96 |  | 
|---|
| 97 | void showDebugOverlay(bool); | 
|---|
| 98 |  | 
|---|
| 99 | protected: | 
|---|
| 100 | // directly Ogre related fields | 
|---|
| 101 | Ogre::SceneManager *sceneMgr_; | 
|---|
| 102 | Ogre::RenderWindow *window_; | 
|---|
| 103 | Ogre::Camera       *camera_; | 
|---|
| 104 |  | 
|---|
| 105 |  | 
|---|
| 106 | // self made orxonox fields | 
|---|
| 107 | OgreControl  *ogre_; | 
|---|
| 108 | OrxonoxScene *backgroundScene_; | 
|---|
| 109 | OrxonoxShip  *playerShip_; | 
|---|
| 110 | hud::HUDOverlay   *hud_; | 
|---|
| 111 |  | 
|---|
| 112 | // Bullet manager | 
|---|
| 113 | weapon::BulletManager *bulletManager_; | 
|---|
| 114 |  | 
|---|
| 115 | const Ogre::Real mouseSensitivity_; | 
|---|
| 116 |  | 
|---|
| 117 | // previously elapsed render time | 
|---|
| 118 | unsigned long totalTime_; | 
|---|
| 119 |  | 
|---|
| 120 |  | 
|---|
| 121 | // fields from the example framework | 
|---|
| 122 | bool statsOn_; | 
|---|
| 123 | std::string debugText_; | 
|---|
| 124 |  | 
|---|
| 125 | unsigned int screenShotCounter_; | 
|---|
| 126 | // just to stop toggles flipping too fast | 
|---|
| 127 | Ogre::Real timeUntilNextToggle_; | 
|---|
| 128 | //bool leftButtonDown_; | 
|---|
| 129 | Ogre::TextureFilterOptions filtering_; | 
|---|
| 130 | int aniso_; | 
|---|
| 131 | int sceneDetailIndex_; | 
|---|
| 132 | Ogre::Overlay* debugOverlay_; | 
|---|
| 133 |  | 
|---|
| 134 | //OIS Input devices | 
|---|
| 135 | OIS::InputManager* inputManager_; | 
|---|
| 136 | OIS::Mouse*    mouse_; | 
|---|
| 137 | OIS::Keyboard* keyboard_; | 
|---|
| 138 | OIS::JoyStick* joystick_; | 
|---|
| 139 |  | 
|---|
| 140 | }; | 
|---|
| 141 |  | 
|---|
| 142 | } | 
|---|
| 143 |  | 
|---|
| 144 | #endif /* RUN_MANAGER_H */ | 
|---|