Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 922 was 922, checked in by rgrieder, 16 years ago
  • created InputEventListener and InputEvent
  • escape key now works through the InputHandler
  • the concept will soon be replaced by a new one this is more of a 'svn save' ;)
File size: 3.1 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 "audio/AudioPrereqs.h"
18
19#include "GraphicsEngine.h"
20#include "InputEventListener.h"
21
22
23// TODO: Orxonox should maybe derive from BaseObject
24//! Orxonox singleton class
25namespace orxonox {
26
27  enum gameMode{
28    SERVER,
29    CLIENT,
30    STANDALONE
31  };
32
33  class _OrxonoxExport Orxonox : public InputEventListener
34  {
35    public:
36      void init(int argc, char **argv, std::string path);
37      void start();
38      // not sure if this should be private
39      void die(/* some error code */);
40      void abortRequest();
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 serverStart();
58      void clientStart();
59      void standaloneStart();
60      void defineResources();
61      void setupRenderSystem();
62      void createRenderWindow();
63      void initializeResourceGroups();
64      void createScene(void);
65      void setupScene();
66      void setupInputSystem();
67      void startRenderLoop();
68      void updateTimers(float);
69      float calculateEventTime(unsigned long, std::deque<unsigned long>&);
70
71      void eventOccured(InputEvent &evt);
72
73    private:
74      GraphicsEngine*       ogre_;          //!< our dearest graphics engine <3
75      std::string           dataPath_;      //!< path to data
76//      loader::LevelLoader*  loader_;        //!< level loader builds the scene
77      audio::AudioManager*  auMan_;         //!< audio manager
78      BulletManager*        bulletMgr_;     //!< Keeps track of the thrown bullets
79      static Orxonox*       singletonRef_;
80      InputHandler*         inputHandler_;
81      //OIS::Keyboard*        keyboard_;
82      //OIS::Mouse*           mouse_;
83      //OIS::InputManager*    inputManager_;
84      OrxListener*          frameListener_;
85      Ogre::Root*           root_;
86      // TODO: make this a config-value by creating a config class for orxonox
87      float                 frameSmoothingTime_;
88      // little hack to actually show something dynamic in the HUD
89      HUD*                  orxonoxHUD_;
90      bool                  bAbort_;
91
92      // this is used to identify the mode (server/client/...) we're in
93      gameMode              mode_;
94      std::string           serverIp_;
95  };
96}
97#endif /* _Orxonox_H__ */
Note: See TracBrowser for help on using the repository browser.