Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/network/src/orxonox/Orxonox.h @ 946

Last change on this file since 946 was 934, checked in by rgrieder, 17 years ago
  • added debug output to the InputHandler
  • fixed singleton issues
  • cleaned up Main.cc (replaced WinMain by main)
File size: 2.8 KB
RevLine 
[612]1/**
2 @file  Orxonox.h
3 @brief Main Orxonox Class File
4 @author Benjamin Knecht <beni_at_orxonox.net>
5 */
6
[673]7#ifndef _Orxonox_H__
8#define _Orxonox_H__
[612]9
[715]10#include <string>
11
[612]12#include <OgrePrerequisites.h>
[926]13//#include <OIS/OISPrereqs.h>
[612]14
15#include "OrxonoxPrereqs.h"
[777]16#include "audio/AudioPrereqs.h"
[729]17
[612]18#include "GraphicsEngine.h"
[922]19#include "InputEventListener.h"
[612]20
21
22// TODO: Orxonox should maybe derive from BaseObject
23//! Orxonox singleton class
24namespace orxonox {
25
26  enum gameMode{
27    SERVER,
28    CLIENT,
[888]29    STANDALONE
[612]30  };
31
[922]32  class _OrxonoxExport Orxonox : public InputEventListener
[612]33  {
34    public:
[715]35      void init(int argc, char **argv, std::string path);
[612]36      void start();
37      // not sure if this should be private
[929]38      void abortImmediate(/* some error code */);
[917]39      void abortRequest();
[929]40      inline Ogre::SceneManager*  getSceneManager()        { return ogre_->getSceneManager(); };
41      inline GraphicsEngine*      getOgrePointer()         { return ogre_; };
[888]42      inline audio::AudioManager* getAudioManagerPointer() { return auMan_; };
[929]43      inline BulletManager*       getBulletMgr()           { return this->bulletMgr_; }
[612]44
[929]45      static Orxonox* getSingleton();
[934]46      static void destroy();
[929]47
48   private:
49      // don't mess with singletons
[612]50      Orxonox();
[929]51      Orxonox(Orxonox& instance);
52      Orxonox& operator=(const Orxonox& instance);
53      ~Orxonox();
54
[612]55      // init functions
[715]56      void serverInit(std::string path);
57      void clientInit(std::string path);
58      void standaloneInit(std::string path);
[929]59
[612]60      // run functions
[888]61      void serverStart();
62      void clientStart();
63      void standaloneStart();
[926]64
[929]65      void createScene();
[612]66      void setupInputSystem();
[888]67      void startRenderLoop();
[917]68      float calculateEventTime(unsigned long, std::deque<unsigned long>&);
[922]69
70      void eventOccured(InputEvent &evt);
[612]71
72    private:
[717]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
[929]77      InputHandler*         inputHandler_;  //!< Handles input with key bindings
78      Ogre::Root*           root_;          //!< Holy grail of Ogre
79      Ogre::Timer*          timer_;         //!< Main loop timer
[917]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_;
[926]84      bool                  bAbort_;        //!< aborts the render loop if true
[612]85
86      // this is used to identify the mode (server/client/...) we're in
87      gameMode              mode_;
[715]88      std::string           serverIp_;
[934]89
90      static Orxonox *singletonRef_s;
[612]91  };
92}
[673]93#endif /* _Orxonox_H__ */
Note: See TracBrowser for help on using the repository browser.