Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/input/src/orxonox/Orxonox.h @ 900

Last change on this file since 900 was 900, checked in by rgrieder, 16 years ago
  • implemented a new main loop, calling the ticks and the timers. —> removed the (Timer/Tick)FrameListener and displaced the code to Orxonox.cc (don't like it yet)
File size: 3.0 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#include <deque>
12
13#include <OgrePrerequisites.h>
14#include <OIS/OISPrereqs.h>
15
16#include "OrxonoxPrereqs.h"
17//#include "loader/LoaderPrereqs.h"
18#include "audio/AudioPrereqs.h"
19
20#include "GraphicsEngine.h"
21
22
23// TODO: Orxonox should maybe derive from BaseObject
24//! Orxonox singleton class
25namespace orxonox {
26
27  enum gameMode{
28    STANDALONE,
29    SERVER,
30    CLIENT,
31    PRESENTATION
32  };
33
34  class _OrxonoxExport Orxonox
35  {
36    public:
37      void init(int argc, char **argv, std::string path);
38      void start();
39      // not sure if this should be private
40      void die(/* some error code */);
41      static Orxonox* getSingleton();
42      inline Ogre::SceneManager* getSceneManager()         { return ogre_->getSceneManager(); };
43      inline GraphicsEngine* getOgrePointer()              { return ogre_; };
44      inline audio::AudioManager* getAudioManagerPointer() { return auMan_; };
45      inline OIS::Keyboard* getKeyboard()                  { return this->keyboard_; }
46      inline OIS::Mouse* getMouse()                        { return this->mouse_; }
47      inline BulletManager* getBulletMgr()                 { return this->bulletMgr_; }
48
49    private:
50      Orxonox();
51      virtual ~Orxonox();
52      // init functions
53      void serverInit(std::string path);
54      void clientInit(std::string path);
55      void standaloneInit(std::string path);
56      // run functions
57      void playableServer(std::string path);
58      void standalone();
59      void defineResources();
60      void setupRenderSystem();
61      void createRenderWindow();
62      void initializeResourceGroups();
63      void createScene(void);
64      void setupScene();
65      void setupInputSystem();
66      void createFrameListener();
67      void startRenderLoop();
68      void mainLoop();
69      void updateTimers(float);
70      float calculateEventTime(unsigned long, std::deque<unsigned long>&);
71
72    private:
73      GraphicsEngine*       ogre_;          //!< our dearest graphics engine <3
74      std::string           dataPath_;      //!< path to data
75//      loader::LevelLoader*  loader_;        //!< level loader builds the scene
76      audio::AudioManager*  auMan_;         //!< audio manager
77      BulletManager*        bulletMgr_;     //!< Keeps track of the thrown bullets
78      static Orxonox*       singletonRef_;
79      OIS::Keyboard*        keyboard_;
80      OIS::Mouse*           mouse_;
81      OIS::InputManager*    inputManager_;
82      OrxListener*          frameListener_;
83      Ogre::Root*           root_;
84      // TODO: make this a config-value by creating a config class for orxonox
85      float                 frameSmoothingTime_;
86      // little hack to actually show something dynamic in the HUD
87      HUD*                  orxonoxHUD_;
88
89      // this is used to identify the mode (server/client/...) we're in
90      gameMode              mode_;
91      std::string           serverIp_;
92  };
93}
94#endif /* _Orxonox_H__ */
Note: See TracBrowser for help on using the repository browser.