Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 929 was 929, checked in by rgrieder, 16 years ago
  • removed getRoot() from GaphicsEngine —> added getRenderWindow() —> added 3 function to control render loop
  • rearranged the sequence of methods in Orxonox.cc to make it a little bit more logical
  • added deletion code in Orxonox.cc destructor
  • fixed a bug in AudioManger destructor
  • fixed a bug in InputHandler destroy()
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 "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
47   private:
48      // don't mess with singletons
49      Orxonox();
50      Orxonox(Orxonox& instance);
51      Orxonox& operator=(const Orxonox& instance);
52      ~Orxonox();
53
54      // init functions
55      void serverInit(std::string path);
56      void clientInit(std::string path);
57      void standaloneInit(std::string path);
58
59      // run functions
60      void serverStart();
61      void clientStart();
62      void standaloneStart();
63
64      void createScene();
65      void setupInputSystem();
66      void startRenderLoop();
67      float calculateEventTime(unsigned long, std::deque<unsigned long>&);
68
69      void eventOccured(InputEvent &evt);
70
71    private:
72      GraphicsEngine*       ogre_;          //!< our dearest graphics engine <3
73      std::string           dataPath_;      //!< path to data
74      audio::AudioManager*  auMan_;         //!< audio manager
75      BulletManager*        bulletMgr_;     //!< Keeps track of the thrown bullets
76      InputHandler*         inputHandler_;  //!< Handles input with key bindings
77      Ogre::Root*           root_;          //!< Holy grail of Ogre
78      Ogre::Timer*          timer_;         //!< Main loop timer
79      // TODO: make this a config-value by creating a config class for orxonox
80      float                 frameSmoothingTime_;
81      // little hack to actually show something dynamic in the HUD
82      HUD*                  orxonoxHUD_;
83      bool                  bAbort_;        //!< aborts the render loop if true
84
85      // this is used to identify the mode (server/client/...) we're in
86      gameMode              mode_;
87      std::string           serverIp_;
88  };
89}
90#endif /* _Orxonox_H__ */
Note: See TracBrowser for help on using the repository browser.