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