| [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" | 
|---|
 | 34 | #include "OgreTextureManager.h" | 
|---|
| [267] | 35 | #include "OgreSingleton.h" | 
|---|
| [190] | 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 | 
|---|
| [267] | 46 |   class RunManager : public Ogre::WindowEventListener, | 
|---|
 | 47 |                      public Ogre::Singleton<RunManager> | 
|---|
| [190] | 48 |   { | 
|---|
 | 49 |   public: | 
|---|
| [267] | 50 |     RunManager(OgreControl*); | 
|---|
| [190] | 51 |  | 
|---|
| [267] | 52 |     virtual ~RunManager(); | 
|---|
 | 53 |     //void initialise(OgreControl*); | 
|---|
| [190] | 54 |  | 
|---|
| [267] | 55 |     bool tick(unsigned long, Ogre::Real); | 
|---|
| [190] | 56 |  | 
|---|
| [267] | 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 |  | 
|---|
| [190] | 72 |   protected: | 
|---|
| [267] | 73 |           void createCamera(void); | 
|---|
| [190] | 74 |  | 
|---|
| [267] | 75 |           void createViewports(void); | 
|---|
| [190] | 76 |  | 
|---|
 | 77 |  | 
|---|
 | 78 |           /** EVENT HANDLING **/ | 
|---|
 | 79 |  | 
|---|
 | 80 |           //Adjust mouse clipping area | 
|---|
| [267] | 81 |           void windowResized(Ogre::RenderWindow*); | 
|---|
| [190] | 82 |  | 
|---|
 | 83 |           //Unattach OIS before window shutdown (very important under Linux) | 
|---|
| [267] | 84 |           void windowClosed(Ogre::RenderWindow*); | 
|---|
| [190] | 85 |  | 
|---|
 | 86 |  | 
|---|
 | 87 |           /** INPUT PROCESSING **/ | 
|---|
| [267] | 88 |           bool processUnbufferedKeyInput(); | 
|---|
| [190] | 89 |  | 
|---|
| [267] | 90 |           bool processUnbufferedMouseInput(); | 
|---|
| [190] | 91 |  | 
|---|
 | 92 |  | 
|---|
 | 93 |           /** OUTPUT **/ | 
|---|
 | 94 |  | 
|---|
| [267] | 95 |           void updateStats(void); | 
|---|
| [190] | 96 |  | 
|---|
| [267] | 97 |           void showDebugOverlay(bool); | 
|---|
| [190] | 98 |  | 
|---|
 | 99 |   protected: | 
|---|
| [267] | 100 |     // directly Ogre related fields | 
|---|
| [190] | 101 |           Ogre::SceneManager *sceneMgr_; | 
|---|
 | 102 |           Ogre::RenderWindow *window_; | 
|---|
 | 103 |           Ogre::Camera       *camera_; | 
|---|
| [267] | 104 |  | 
|---|
 | 105 |  | 
|---|
 | 106 |     // self made orxonox fields | 
|---|
| [190] | 107 |           OgreControl  *ogre_; | 
|---|
 | 108 |           OrxonoxScene *backgroundScene_; | 
|---|
 | 109 |           OrxonoxShip  *playerShip_; | 
|---|
| [267] | 110 |     hud::HUDOverlay   *hud_; | 
|---|
| [190] | 111 |  | 
|---|
| [267] | 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 | 
|---|
| [190] | 122 |           bool statsOn_; | 
|---|
 | 123 |           std::string debugText_; | 
|---|
 | 124 |  | 
|---|
 | 125 |           unsigned int screenShotCounter_; | 
|---|
 | 126 |           // just to stop toggles flipping too fast | 
|---|
 | 127 |           Ogre::Real timeUntilNextToggle_; | 
|---|
| [267] | 128 |           //bool leftButtonDown_; | 
|---|
| [190] | 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 */ | 
|---|