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 | |
---|
14 | #include "OrxonoxPrereqs.h" |
---|
15 | #include "audio/AudioPrereqs.h" |
---|
16 | |
---|
17 | #include "GraphicsEngine.h" |
---|
18 | #include "core/InputEventListener.h" |
---|
19 | |
---|
20 | |
---|
21 | namespace orxonox { |
---|
22 | |
---|
23 | enum gameMode{ |
---|
24 | SERVER, |
---|
25 | CLIENT, |
---|
26 | STANDALONE |
---|
27 | }; |
---|
28 | |
---|
29 | //! Orxonox singleton class |
---|
30 | class _OrxonoxExport Orxonox : public InputEventListener |
---|
31 | { |
---|
32 | public: |
---|
33 | void init(int argc, char **argv, std::string path); |
---|
34 | void start(); |
---|
35 | // not sure if this should be private |
---|
36 | void abortImmediate(/* some error code */); |
---|
37 | void abortRequest(); |
---|
38 | inline audio::AudioManager* getAudioManagerPointer() { return auMan_; }; |
---|
39 | |
---|
40 | static Orxonox* getSingleton(); |
---|
41 | static void destroySingleton(); |
---|
42 | |
---|
43 | private: |
---|
44 | // don't mess with singletons |
---|
45 | Orxonox(); |
---|
46 | Orxonox(Orxonox& instance); |
---|
47 | Orxonox& operator=(const Orxonox& instance); |
---|
48 | ~Orxonox(); |
---|
49 | |
---|
50 | // init functions |
---|
51 | void serverInit(std::string path); |
---|
52 | void clientInit(std::string path); |
---|
53 | void standaloneInit(std::string path); |
---|
54 | |
---|
55 | // run functions |
---|
56 | void serverStart(); |
---|
57 | void clientStart(); |
---|
58 | void standaloneStart(); |
---|
59 | |
---|
60 | void createScene(); |
---|
61 | void setupInputSystem(); |
---|
62 | void startRenderLoop(); |
---|
63 | float calculateEventTime(unsigned long, std::deque<unsigned long>&); |
---|
64 | |
---|
65 | void eventOccured(InputEvent &evt); |
---|
66 | |
---|
67 | private: |
---|
68 | GraphicsEngine* ogre_; //!< our dearest graphics engine <3 |
---|
69 | std::string dataPath_; //!< path to data |
---|
70 | audio::AudioManager* auMan_; //!< audio manager |
---|
71 | InputManager* inputHandler_; //!< Handles input with key bindings |
---|
72 | Ogre::Timer* timer_; //!< Main loop timer |
---|
73 | // TODO: make this a config-value by creating a config class for orxonox |
---|
74 | float frameSmoothingTime_; |
---|
75 | HUD* orxonoxHUD_; |
---|
76 | bool bAbort_; //!< aborts the render loop if true |
---|
77 | |
---|
78 | // this is used to identify the mode (server/client/...) we're in |
---|
79 | gameMode mode_; |
---|
80 | std::string serverIp_; |
---|
81 | |
---|
82 | static Orxonox *singletonRef_s; |
---|
83 | }; |
---|
84 | } |
---|
85 | #endif /* _Orxonox_H__ */ |
---|