1 | /** |
---|
2 | @file Orxonox.h |
---|
3 | @brief Main Orxonox Class File |
---|
4 | @author Benjamin Knecht <beni_at_orxonox.net> |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _Orxonox_H__ |
---|
8 | #define _Orxonox_H__ |
---|
9 | |
---|
10 | #include <string> |
---|
11 | |
---|
12 | #include <OgrePrerequisites.h> |
---|
13 | #include <OIS/OISPrereqs.h> |
---|
14 | |
---|
15 | #include "OrxonoxPrereqs.h" |
---|
16 | //#include "loader/LoaderPrereqs.h" |
---|
17 | #include "audio/AudioPrereqs.h" |
---|
18 | |
---|
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, |
---|
29 | STANDALONE |
---|
30 | }; |
---|
31 | |
---|
32 | class _OrxonoxExport Orxonox |
---|
33 | { |
---|
34 | public: |
---|
35 | void init(int argc, char **argv, std::string path); |
---|
36 | void start(); |
---|
37 | // not sure if this should be private |
---|
38 | void die(/* some error code */); |
---|
39 | static Orxonox* getSingleton(); |
---|
40 | inline Ogre::SceneManager* getSceneManager() { return ogre_->getSceneManager(); }; |
---|
41 | inline GraphicsEngine* getOgrePointer() { return ogre_; }; |
---|
42 | inline audio::AudioManager* getAudioManagerPointer() { return auMan_; }; |
---|
43 | inline OIS::Keyboard* getKeyboard() { return this->keyboard_; } |
---|
44 | inline OIS::Mouse* getMouse() { return this->mouse_; } |
---|
45 | inline BulletManager* getBulletMgr() { return this->bulletMgr_; } |
---|
46 | |
---|
47 | private: |
---|
48 | Orxonox(); |
---|
49 | virtual ~Orxonox(); |
---|
50 | // init functions |
---|
51 | void serverInit(std::string path); |
---|
52 | void clientInit(std::string path); |
---|
53 | void standaloneInit(std::string path); |
---|
54 | // run functions |
---|
55 | void serverStart(); |
---|
56 | void clientStart(); |
---|
57 | void standaloneStart(); |
---|
58 | void defineResources(); |
---|
59 | void setupRenderSystem(); |
---|
60 | void createRenderWindow(); |
---|
61 | void initializeResourceGroups(); |
---|
62 | void createScene(void); |
---|
63 | void setupScene(); |
---|
64 | void setupInputSystem(); |
---|
65 | void createFrameListener(); |
---|
66 | void startRenderLoop(); |
---|
67 | |
---|
68 | private: |
---|
69 | GraphicsEngine* ogre_; //!< our dearest graphics engine <3 |
---|
70 | std::string dataPath_; //!< path to data |
---|
71 | // loader::LevelLoader* loader_; //!< level loader builds the scene |
---|
72 | audio::AudioManager* auMan_; //!< audio manager |
---|
73 | BulletManager* bulletMgr_; //!< Keeps track of the thrown bullets |
---|
74 | static Orxonox* singletonRef_; |
---|
75 | OIS::Keyboard* keyboard_; |
---|
76 | OIS::Mouse* mouse_; |
---|
77 | OIS::InputManager* inputManager_; |
---|
78 | OrxListener* frameListener_; |
---|
79 | Ogre::Root* root_; |
---|
80 | |
---|
81 | // this is used to identify the mode (server/client/...) we're in |
---|
82 | gameMode mode_; |
---|
83 | std::string serverIp_; |
---|
84 | }; |
---|
85 | } |
---|
86 | #endif /* _Orxonox_H__ */ |
---|