Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/Orxonox.h @ 1052

Last change on this file since 1052 was 1052, checked in by landauf, 16 years ago

merged core2 back to trunk
there might be some errors, wasn't able to test it yet due to some strange g++ and linker behaviour.

File size: 2.7 KB
Line 
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 "OrxonoxPrereqs.h"
11
12#include <string>
13
14#include <OgrePrerequisites.h>
15#include "audio/AudioPrereqs.h"
16
17#include "GraphicsEngine.h"
18#include "core/InputEventListener.h"
19
20
21namespace 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      static inline void slomo(float factor) { Orxonox::getSingleton()->timefactor_ = factor; }
44      static inline void setTimeFactor(float factor = 1.0) { Orxonox::getSingleton()->timefactor_ = factor; }
45      static inline float getTimeFactor() { return Orxonox::getSingleton()->timefactor_; }
46      static inline void exit() { Orxonox::getSingleton()->abortRequest(); }
47
48   private:
49      // don't mess with singletons
50      Orxonox();
51      Orxonox(Orxonox& instance);
52      Orxonox& operator=(const Orxonox& instance);
53      ~Orxonox();
54
55      // init functions
56      void serverInit(std::string path);
57      void clientInit(std::string path);
58      void standaloneInit(std::string path);
59
60      // run functions
61      void serverStart();
62      void clientStart();
63      void standaloneStart();
64
65      void createScene();
66      void setupInputSystem();
67      void startRenderLoop();
68      float calculateEventTime(unsigned long, std::deque<unsigned long>&);
69
70      void eventOccured(InputEvent &evt);
71
72    private:
73      GraphicsEngine*       ogre_;          //!< our dearest graphics engine <3
74      std::string           dataPath_;      //!< path to data
75      audio::AudioManager*  auMan_;         //!< audio manager
76      InputManager*         inputHandler_;  //!< Handles input with key bindings
77      Ogre::Timer*          timer_;         //!< Main loop timer
78      // TODO: make this a config-value by creating a config class for orxonox
79      float                 frameSmoothingTime_;
80      HUD*                  orxonoxHUD_;
81      bool                  bAbort_;        //!< aborts the render loop if true
82      float                 timefactor_;    //!< A factor to change the gamespeed
83
84      // this is used to identify the mode (server/client/...) we're in
85      gameMode              mode_;
86      std::string           serverIp_;
87
88      static Orxonox *singletonRef_s;
89  };
90}
91#endif /* _Orxonox_H__ */
Note: See TracBrowser for help on using the repository browser.