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 "GraphicsEngine.h" |
---|
18 | |
---|
19 | |
---|
20 | // TODO: Orxonox should maybe derive from BaseObject |
---|
21 | //! Orxonox singleton class |
---|
22 | namespace orxonox { |
---|
23 | |
---|
24 | enum gameMode{ |
---|
25 | STANDALONE, |
---|
26 | SERVER, |
---|
27 | CLIENT, |
---|
28 | PRESENTATION |
---|
29 | }; |
---|
30 | |
---|
31 | class Orxonox |
---|
32 | { |
---|
33 | public: |
---|
34 | void init(int argc, char **argv, std::string path); |
---|
35 | void start(); |
---|
36 | // not sure if this should be private |
---|
37 | void die(/* some error code */); |
---|
38 | static Orxonox* getSingleton(); |
---|
39 | inline Ogre::SceneManager* getSceneManager() { return ogre_->getSceneManager(); }; |
---|
40 | inline GraphicsEngine* getOgrePointer() { return ogre_; }; |
---|
41 | inline audio::AudioManager* getAudioManagerPointer() { return auMan_; }; |
---|
42 | inline OIS::Keyboard* getKeyboard() { return this->keyboard_; } |
---|
43 | inline OIS::Mouse* getMouse() { return this->mouse_; } |
---|
44 | inline BulletManager* getBulletMgr() { return this->bulletMgr_; } |
---|
45 | |
---|
46 | private: |
---|
47 | Orxonox(); |
---|
48 | virtual ~Orxonox(); |
---|
49 | // init functions |
---|
50 | void serverInit(std::string path); |
---|
51 | void clientInit(std::string path); |
---|
52 | void standaloneInit(std::string path); |
---|
53 | // run functions |
---|
54 | void playableServer(std::string path); |
---|
55 | void standalone(); |
---|
56 | void defineResources(); |
---|
57 | void setupRenderSystem(); |
---|
58 | void createRenderWindow(); |
---|
59 | void initializeResourceGroups(); |
---|
60 | void createScene(void); |
---|
61 | void setupScene(); |
---|
62 | void setupInputSystem(); |
---|
63 | void createFrameListener(); |
---|
64 | void startRenderLoop(); |
---|
65 | |
---|
66 | private: |
---|
67 | GraphicsEngine* ogre_; //!< our dearest graphics engine <3 |
---|
68 | std::string dataPath_; //!< path to data |
---|
69 | loader::LevelLoader* loader_; //!< level loader builds the scene |
---|
70 | audio::AudioManager* auMan_; //!< audio manager |
---|
71 | BulletManager* bulletMgr_; //!< Keeps track of the thrown bullets |
---|
72 | static Orxonox* singletonRef_; |
---|
73 | OIS::Keyboard* keyboard_; |
---|
74 | OIS::Mouse* mouse_; |
---|
75 | OIS::InputManager* inputManager_; |
---|
76 | OrxListener* frameListener_; |
---|
77 | Ogre::Root* root_; |
---|
78 | |
---|
79 | // this is used to identify the mode (server/client/...) we're in |
---|
80 | gameMode mode_; |
---|
81 | std::string serverIp_; |
---|
82 | }; |
---|
83 | } |
---|
84 | #endif /* _Orxonox_H__ */ |
---|