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 | STANDALONE, |
---|
28 | SERVER, |
---|
29 | CLIENT |
---|
30 | }; |
---|
31 | |
---|
32 | union OrxListener{ |
---|
33 | OrxListenerClient *client; |
---|
34 | OrxListenerServer *server; |
---|
35 | OrxListenerStandalone *standalone; |
---|
36 | }; |
---|
37 | |
---|
38 | class _OrxonoxExport Orxonox |
---|
39 | { |
---|
40 | public: |
---|
41 | void init(int argc, char **argv, std::string path); |
---|
42 | void start(); |
---|
43 | // not sure if this should be private |
---|
44 | void die(/* some error code */); |
---|
45 | static Orxonox* getSingleton(); |
---|
46 | inline Ogre::SceneManager* getSceneManager() { return ogre_->getSceneManager(); }; |
---|
47 | inline GraphicsEngine* getOgrePointer() { return ogre_; }; |
---|
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_; } |
---|
52 | |
---|
53 | private: |
---|
54 | Orxonox(); |
---|
55 | virtual ~Orxonox(); |
---|
56 | // init functions |
---|
57 | void startStandalone(); |
---|
58 | void startServer(); |
---|
59 | void startClient(); |
---|
60 | void serverInit(std::string path); |
---|
61 | void clientInit(std::string path); |
---|
62 | void standaloneInit(std::string path); |
---|
63 | // run functions |
---|
64 | void playableServer(std::string path); |
---|
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(); |
---|
74 | void startRenderLoop(); |
---|
75 | |
---|
76 | private: |
---|
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 |
---|
82 | static Orxonox* singletonRef_; |
---|
83 | OIS::Keyboard* keyboard_; |
---|
84 | OIS::Mouse* mouse_; |
---|
85 | OIS::InputManager* inputManager_; |
---|
86 | OrxListener frameListener_; |
---|
87 | Ogre::Root* root_; |
---|
88 | |
---|
89 | // this is used to identify the mode (server/client/...) we're in |
---|
90 | gameMode mode_; |
---|
91 | std::string serverIp_; |
---|
92 | }; |
---|
93 | } |
---|
94 | #endif /* _Orxonox_H__ */ |
---|