[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> |
---|
[868] | 13 | #include <OIS/OISPrereqs.h> |
---|
[612] | 14 | |
---|
| 15 | #include "OrxonoxPrereqs.h" |
---|
[682] | 16 | #include "loader/LoaderPrereqs.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 | STANDALONE, |
---|
| 28 | SERVER, |
---|
[868] | 29 | CLIENT |
---|
[612] | 30 | }; |
---|
| 31 | |
---|
[868] | 32 | union OrxListener{ |
---|
| 33 | OrxListenerClient *client; |
---|
| 34 | OrxListenerServer *server; |
---|
| 35 | OrxListenerStandalone *standalone; |
---|
| 36 | }; |
---|
| 37 | |
---|
[729] | 38 | class _OrxonoxExport Orxonox |
---|
[612] | 39 | { |
---|
| 40 | public: |
---|
[715] | 41 | void init(int argc, char **argv, std::string path); |
---|
[612] | 42 | void start(); |
---|
| 43 | // not sure if this should be private |
---|
| 44 | void die(/* some error code */); |
---|
| 45 | static Orxonox* getSingleton(); |
---|
[637] | 46 | inline Ogre::SceneManager* getSceneManager() { return ogre_->getSceneManager(); }; |
---|
| 47 | inline GraphicsEngine* getOgrePointer() { return ogre_; }; |
---|
[868] | 48 | inline audio::AudioManager* getAudioManagerPointer() { return auMan_; }; |
---|
| 49 | inline OIS::Keyboard* getKeyboard() { return this->keyboard_; } |
---|
| 50 | inline OIS::Mouse* getMouse() { return this->mouse_; } |
---|
| 51 | inline BulletManager* getBulletMgr() { return this->bulletMgr_; } |
---|
[612] | 52 | |
---|
| 53 | private: |
---|
| 54 | Orxonox(); |
---|
| 55 | virtual ~Orxonox(); |
---|
| 56 | // init functions |
---|
[868] | 57 | void startStandalone(); |
---|
| 58 | void startServer(); |
---|
| 59 | void startClient(); |
---|
[715] | 60 | void serverInit(std::string path); |
---|
| 61 | void clientInit(std::string path); |
---|
| 62 | void standaloneInit(std::string path); |
---|
[612] | 63 | // run functions |
---|
[715] | 64 | void playableServer(std::string path); |
---|
[612] | 65 | void standalone(); |
---|
| 66 | void defineResources(); |
---|
| 67 | void setupRenderSystem(); |
---|
| 68 | void createRenderWindow(); |
---|
| 69 | void initializeResourceGroups(); |
---|
| 70 | void createScene(void); |
---|
| 71 | void setupScene(); |
---|
| 72 | void setupInputSystem(); |
---|
| 73 | void createFrameListener(); |
---|
[868] | 74 | void startRenderLoop(); |
---|
[612] | 75 | |
---|
| 76 | private: |
---|
[717] | 77 | GraphicsEngine* ogre_; //!< our dearest graphics engine <3 |
---|
| 78 | std::string dataPath_; //!< path to data |
---|
| 79 | loader::LevelLoader* loader_; //!< level loader builds the scene |
---|
| 80 | audio::AudioManager* auMan_; //!< audio manager |
---|
| 81 | BulletManager* bulletMgr_; //!< Keeps track of the thrown bullets |
---|
[612] | 82 | static Orxonox* singletonRef_; |
---|
| 83 | OIS::Keyboard* keyboard_; |
---|
| 84 | OIS::Mouse* mouse_; |
---|
| 85 | OIS::InputManager* inputManager_; |
---|
[868] | 86 | OrxListener frameListener_; |
---|
[612] | 87 | Ogre::Root* root_; |
---|
| 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__ */ |
---|