Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/hud2/src/orxonox/Orxonox.h @ 991

Last change on this file since 991 was 973, checked in by rgrieder, 17 years ago
  • not really done a lot, but svn create patch doesn't work with renamed files
File size: 2.8 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 <string>
11
12#include <OgrePrerequisites.h>
13//#include <OIS/OISPrereqs.h>
14
15#include "OrxonoxPrereqs.h"
16#include "audio/AudioPrereqs.h"
17
18#include "GraphicsEngine.h"
19#include "core/InputEventListener.h"
20
21
22// TODO: Orxonox should maybe derive from BaseObject
23//! Orxonox singleton class
24namespace orxonox {
25
26  enum gameMode{
27    SERVER,
28    CLIENT,
29    STANDALONE
30  };
31
32  class _OrxonoxExport Orxonox : public InputEventListener
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 abortImmediate(/* some error code */);
39      void abortRequest();
40      inline Ogre::SceneManager*  getSceneManager()        { return ogre_->getSceneManager(); };
41      inline GraphicsEngine*      getOgrePointer()         { return ogre_; };
42      inline audio::AudioManager* getAudioManagerPointer() { return auMan_; };
43      inline BulletManager*       getBulletMgr()           { return this->bulletMgr_; }
44
45      static Orxonox* getSingleton();
46      static void destroySingleton();
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      BulletManager*        bulletMgr_;     //!< Keeps track of the thrown bullets
77      InputManager*         inputHandler_;  //!< Handles input with key bindings
78      Ogre::Root*           root_;          //!< Holy grail of Ogre
79      Ogre::Timer*          timer_;         //!< Main loop timer
80      // TODO: make this a config-value by creating a config class for orxonox
81      float                 frameSmoothingTime_;
82      // little hack to actually show something dynamic in the HUD
83      HUD*                  orxonoxHUD_;
84      bool                  bAbort_;        //!< aborts the render loop if true
85
86      // this is used to identify the mode (server/client/...) we're in
87      gameMode              mode_;
88      std::string           serverIp_;
89
90      static Orxonox *singletonRef_s;
91  };
92}
93#endif /* _Orxonox_H__ */
Note: See TracBrowser for help on using the repository browser.