[612] | 1 | /** |
---|
| 2 | @file Orxonox.h |
---|
| 3 | @brief Main Orxonox Class File |
---|
| 4 | @author Benjamin Knecht <beni_at_orxonox.net> |
---|
| 5 | */ |
---|
| 6 | |
---|
[673] | 7 | #ifndef _Orxonox_H__ |
---|
| 8 | #define _Orxonox_H__ |
---|
[612] | 9 | |
---|
[715] | 10 | #include <string> |
---|
[917] | 11 | #include <deque> |
---|
[715] | 12 | |
---|
[612] | 13 | #include <OgrePrerequisites.h> |
---|
[888] | 14 | #include <OIS/OISPrereqs.h> |
---|
[612] | 15 | |
---|
| 16 | #include "OrxonoxPrereqs.h" |
---|
[777] | 17 | #include "audio/AudioPrereqs.h" |
---|
[729] | 18 | |
---|
[612] | 19 | #include "GraphicsEngine.h" |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | // TODO: Orxonox should maybe derive from BaseObject |
---|
| 23 | //! Orxonox singleton class |
---|
| 24 | namespace orxonox { |
---|
| 25 | |
---|
| 26 | enum gameMode{ |
---|
| 27 | SERVER, |
---|
| 28 | CLIENT, |
---|
[888] | 29 | STANDALONE |
---|
[612] | 30 | }; |
---|
| 31 | |
---|
[729] | 32 | class _OrxonoxExport Orxonox |
---|
[612] | 33 | { |
---|
| 34 | public: |
---|
[715] | 35 | void init(int argc, char **argv, std::string path); |
---|
[612] | 36 | void start(); |
---|
| 37 | // not sure if this should be private |
---|
| 38 | void die(/* some error code */); |
---|
[917] | 39 | void abortRequest(); |
---|
[612] | 40 | static Orxonox* getSingleton(); |
---|
[637] | 41 | inline Ogre::SceneManager* getSceneManager() { return ogre_->getSceneManager(); }; |
---|
| 42 | inline GraphicsEngine* getOgrePointer() { return ogre_; }; |
---|
[888] | 43 | inline audio::AudioManager* getAudioManagerPointer() { return auMan_; }; |
---|
[919] | 44 | //inline OIS::Keyboard* getKeyboard() { return this->keyboard_; } |
---|
| 45 | //inline OIS::Mouse* getMouse() { return this->mouse_; } |
---|
[888] | 46 | inline BulletManager* getBulletMgr() { return this->bulletMgr_; } |
---|
[612] | 47 | |
---|
| 48 | private: |
---|
| 49 | Orxonox(); |
---|
| 50 | virtual ~Orxonox(); |
---|
| 51 | // init functions |
---|
[715] | 52 | void serverInit(std::string path); |
---|
| 53 | void clientInit(std::string path); |
---|
| 54 | void standaloneInit(std::string path); |
---|
[612] | 55 | // run functions |
---|
[888] | 56 | void serverStart(); |
---|
| 57 | void clientStart(); |
---|
| 58 | void standaloneStart(); |
---|
[612] | 59 | void defineResources(); |
---|
| 60 | void setupRenderSystem(); |
---|
| 61 | void createRenderWindow(); |
---|
| 62 | void initializeResourceGroups(); |
---|
| 63 | void createScene(void); |
---|
| 64 | void setupScene(); |
---|
| 65 | void setupInputSystem(); |
---|
[888] | 66 | void startRenderLoop(); |
---|
[917] | 67 | void updateTimers(float); |
---|
| 68 | float calculateEventTime(unsigned long, std::deque<unsigned long>&); |
---|
[612] | 69 | |
---|
| 70 | private: |
---|
[717] | 71 | GraphicsEngine* ogre_; //!< our dearest graphics engine <3 |
---|
| 72 | std::string dataPath_; //!< path to data |
---|
[871] | 73 | // loader::LevelLoader* loader_; //!< level loader builds the scene |
---|
[717] | 74 | audio::AudioManager* auMan_; //!< audio manager |
---|
| 75 | BulletManager* bulletMgr_; //!< Keeps track of the thrown bullets |
---|
[612] | 76 | static Orxonox* singletonRef_; |
---|
[919] | 77 | InputHandler* inputHandler_; |
---|
| 78 | //OIS::Keyboard* keyboard_; |
---|
| 79 | //OIS::Mouse* mouse_; |
---|
| 80 | //OIS::InputManager* inputManager_; |
---|
[612] | 81 | OrxListener* frameListener_; |
---|
| 82 | Ogre::Root* root_; |
---|
[917] | 83 | // TODO: make this a config-value by creating a config class for orxonox |
---|
| 84 | float frameSmoothingTime_; |
---|
| 85 | // little hack to actually show something dynamic in the HUD |
---|
| 86 | HUD* orxonoxHUD_; |
---|
| 87 | bool bAbort_; |
---|
[612] | 88 | |
---|
| 89 | // this is used to identify the mode (server/client/...) we're in |
---|
| 90 | gameMode mode_; |
---|
[715] | 91 | std::string serverIp_; |
---|
[612] | 92 | }; |
---|
| 93 | } |
---|
[673] | 94 | #endif /* _Orxonox_H__ */ |
---|