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 | #include <deque> |
---|
12 | |
---|
13 | #include <OgrePrerequisites.h> |
---|
14 | #include <OIS/OISPrereqs.h> |
---|
15 | |
---|
16 | #include "OrxonoxPrereqs.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 | void abortRequest(); |
---|
40 | static Orxonox* getSingleton(); |
---|
41 | inline Ogre::SceneManager* getSceneManager() { return ogre_->getSceneManager(); }; |
---|
42 | inline GraphicsEngine* getOgrePointer() { return ogre_; }; |
---|
43 | inline audio::AudioManager* getAudioManagerPointer() { return auMan_; }; |
---|
44 | //inline OIS::Keyboard* getKeyboard() { return this->keyboard_; } |
---|
45 | //inline OIS::Mouse* getMouse() { return this->mouse_; } |
---|
46 | inline BulletManager* getBulletMgr() { return this->bulletMgr_; } |
---|
47 | |
---|
48 | private: |
---|
49 | Orxonox(); |
---|
50 | virtual ~Orxonox(); |
---|
51 | // init functions |
---|
52 | void serverInit(std::string path); |
---|
53 | void clientInit(std::string path); |
---|
54 | void standaloneInit(std::string path); |
---|
55 | // run functions |
---|
56 | void serverStart(); |
---|
57 | void clientStart(); |
---|
58 | void standaloneStart(); |
---|
59 | void defineResources(); |
---|
60 | void setupRenderSystem(); |
---|
61 | void createRenderWindow(); |
---|
62 | void initializeResourceGroups(); |
---|
63 | void createScene(void); |
---|
64 | void setupScene(); |
---|
65 | void setupInputSystem(); |
---|
66 | void startRenderLoop(); |
---|
67 | void updateTimers(float); |
---|
68 | float calculateEventTime(unsigned long, std::deque<unsigned long>&); |
---|
69 | |
---|
70 | private: |
---|
71 | GraphicsEngine* ogre_; //!< our dearest graphics engine <3 |
---|
72 | std::string dataPath_; //!< path to data |
---|
73 | // loader::LevelLoader* loader_; //!< level loader builds the scene |
---|
74 | audio::AudioManager* auMan_; //!< audio manager |
---|
75 | BulletManager* bulletMgr_; //!< Keeps track of the thrown bullets |
---|
76 | static Orxonox* singletonRef_; |
---|
77 | InputHandler* inputHandler_; |
---|
78 | //OIS::Keyboard* keyboard_; |
---|
79 | //OIS::Mouse* mouse_; |
---|
80 | //OIS::InputManager* inputManager_; |
---|
81 | OrxListener* frameListener_; |
---|
82 | Ogre::Root* root_; |
---|
83 | // TODO: make this a config-value by creating a config class for orxonox |
---|
84 | float frameSmoothingTime_; |
---|
85 | // little hack to actually show something dynamic in the HUD |
---|
86 | HUD* orxonoxHUD_; |
---|
87 | bool bAbort_; |
---|
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__ */ |
---|