[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> |
---|
| 11 | |
---|
[612] | 12 | #include <OgrePrerequisites.h> |
---|
| 13 | |
---|
| 14 | #include "OrxonoxPrereqs.h" |
---|
[777] | 15 | #include "audio/AudioPrereqs.h" |
---|
[729] | 16 | |
---|
[612] | 17 | #include "GraphicsEngine.h" |
---|
[1024] | 18 | #include "core/InputEventListener.h" |
---|
[612] | 19 | |
---|
| 20 | |
---|
| 21 | namespace orxonox { |
---|
| 22 | |
---|
| 23 | enum gameMode{ |
---|
| 24 | SERVER, |
---|
| 25 | CLIENT, |
---|
[1021] | 26 | STANDALONE |
---|
[612] | 27 | }; |
---|
| 28 | |
---|
[1032] | 29 | //! Orxonox singleton class |
---|
[1021] | 30 | class _OrxonoxExport Orxonox : public InputEventListener |
---|
[612] | 31 | { |
---|
| 32 | public: |
---|
[715] | 33 | void init(int argc, char **argv, std::string path); |
---|
[612] | 34 | void start(); |
---|
| 35 | // not sure if this should be private |
---|
[1021] | 36 | void abortImmediate(/* some error code */); |
---|
| 37 | void abortRequest(); |
---|
| 38 | inline audio::AudioManager* getAudioManagerPointer() { return auMan_; }; |
---|
| 39 | |
---|
[612] | 40 | static Orxonox* getSingleton(); |
---|
[1024] | 41 | static void destroySingleton(); |
---|
[612] | 42 | |
---|
[1021] | 43 | private: |
---|
| 44 | // don't mess with singletons |
---|
[612] | 45 | Orxonox(); |
---|
[1021] | 46 | Orxonox(Orxonox& instance); |
---|
| 47 | Orxonox& operator=(const Orxonox& instance); |
---|
| 48 | ~Orxonox(); |
---|
| 49 | |
---|
[612] | 50 | // init functions |
---|
[715] | 51 | void serverInit(std::string path); |
---|
| 52 | void clientInit(std::string path); |
---|
| 53 | void standaloneInit(std::string path); |
---|
[1021] | 54 | |
---|
[612] | 55 | // run functions |
---|
[1021] | 56 | void serverStart(); |
---|
| 57 | void clientStart(); |
---|
| 58 | void standaloneStart(); |
---|
| 59 | |
---|
| 60 | void createScene(); |
---|
[612] | 61 | void setupInputSystem(); |
---|
[1021] | 62 | void startRenderLoop(); |
---|
[1024] | 63 | float calculateEventTime(unsigned long, std::deque<unsigned long>&); |
---|
[612] | 64 | |
---|
[1024] | 65 | void eventOccured(InputEvent &evt); |
---|
| 66 | |
---|
[612] | 67 | private: |
---|
[717] | 68 | GraphicsEngine* ogre_; //!< our dearest graphics engine <3 |
---|
| 69 | std::string dataPath_; //!< path to data |
---|
| 70 | audio::AudioManager* auMan_; //!< audio manager |
---|
[1024] | 71 | InputManager* inputHandler_; //!< Handles input with key bindings |
---|
[1021] | 72 | Ogre::Timer* timer_; //!< Main loop timer |
---|
| 73 | // TODO: make this a config-value by creating a config class for orxonox |
---|
| 74 | float frameSmoothingTime_; |
---|
| 75 | HUD* orxonoxHUD_; |
---|
| 76 | bool bAbort_; //!< aborts the render loop if true |
---|
[612] | 77 | |
---|
| 78 | // this is used to identify the mode (server/client/...) we're in |
---|
| 79 | gameMode mode_; |
---|
[715] | 80 | std::string serverIp_; |
---|
[1021] | 81 | |
---|
| 82 | static Orxonox *singletonRef_s; |
---|
[612] | 83 | }; |
---|
| 84 | } |
---|
[673] | 85 | #endif /* _Orxonox_H__ */ |
---|