[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> |
---|
[900] | 11 | #include <deque> |
---|
[715] | 12 | |
---|
[612] | 13 | #include <OgrePrerequisites.h> |
---|
| 14 | #include <OIS/OISPrereqs.h> |
---|
| 15 | |
---|
| 16 | #include "OrxonoxPrereqs.h" |
---|
[871] | 17 | //#include "loader/LoaderPrereqs.h" |
---|
[777] | 18 | #include "audio/AudioPrereqs.h" |
---|
[729] | 19 | |
---|
[612] | 20 | #include "GraphicsEngine.h" |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | // TODO: Orxonox should maybe derive from BaseObject |
---|
| 24 | //! Orxonox singleton class |
---|
| 25 | namespace orxonox { |
---|
| 26 | |
---|
| 27 | enum gameMode{ |
---|
| 28 | STANDALONE, |
---|
| 29 | SERVER, |
---|
| 30 | CLIENT, |
---|
| 31 | PRESENTATION |
---|
| 32 | }; |
---|
| 33 | |
---|
[729] | 34 | class _OrxonoxExport Orxonox |
---|
[612] | 35 | { |
---|
| 36 | public: |
---|
[715] | 37 | void init(int argc, char **argv, std::string path); |
---|
[612] | 38 | void start(); |
---|
| 39 | // not sure if this should be private |
---|
| 40 | void die(/* some error code */); |
---|
| 41 | static Orxonox* getSingleton(); |
---|
[637] | 42 | inline Ogre::SceneManager* getSceneManager() { return ogre_->getSceneManager(); }; |
---|
| 43 | inline GraphicsEngine* getOgrePointer() { return ogre_; }; |
---|
[612] | 44 | inline audio::AudioManager* getAudioManagerPointer() { return auMan_; }; |
---|
[637] | 45 | inline OIS::Keyboard* getKeyboard() { return this->keyboard_; } |
---|
| 46 | inline OIS::Mouse* getMouse() { return this->mouse_; } |
---|
| 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 |
---|
[715] | 57 | void playableServer(std::string path); |
---|
[612] | 58 | void standalone(); |
---|
| 59 | void defineResources(); |
---|
| 60 | void setupRenderSystem(); |
---|
| 61 | void createRenderWindow(); |
---|
| 62 | void initializeResourceGroups(); |
---|
| 63 | void createScene(void); |
---|
| 64 | void setupScene(); |
---|
| 65 | void setupInputSystem(); |
---|
| 66 | void createFrameListener(); |
---|
| 67 | void startRenderLoop(); |
---|
[900] | 68 | void mainLoop(); |
---|
| 69 | void updateTimers(float); |
---|
| 70 | float calculateEventTime(unsigned long, std::deque<unsigned long>&); |
---|
[612] | 71 | |
---|
| 72 | private: |
---|
[717] | 73 | GraphicsEngine* ogre_; //!< our dearest graphics engine <3 |
---|
| 74 | std::string dataPath_; //!< path to data |
---|
[871] | 75 | // loader::LevelLoader* loader_; //!< level loader builds the scene |
---|
[717] | 76 | audio::AudioManager* auMan_; //!< audio manager |
---|
| 77 | BulletManager* bulletMgr_; //!< Keeps track of the thrown bullets |
---|
[612] | 78 | static Orxonox* singletonRef_; |
---|
| 79 | OIS::Keyboard* keyboard_; |
---|
| 80 | OIS::Mouse* mouse_; |
---|
| 81 | OIS::InputManager* inputManager_; |
---|
| 82 | OrxListener* frameListener_; |
---|
| 83 | Ogre::Root* root_; |
---|
[900] | 84 | // TODO: make this a config-value by creating a config class for orxonox |
---|
| 85 | float frameSmoothingTime_; |
---|
| 86 | // little hack to actually show something dynamic in the HUD |
---|
| 87 | HUD* orxonoxHUD_; |
---|
[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__ */ |
---|