Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 917 was 917, checked in by rgrieder, 16 years ago
  • merged all changes in the input branch into this one
  • moved Tickable to core (would have created circular library dependencies)
  • exported OrxListener to a separate file, soon to be deleted
changed
, &&, XOR back to or, and, xor because I found the necessary include file for VC++
  • created abortRequest() in Orxonox.cc to call for a smooth end of the game (an alternative would be to make tick() return a boolean, like it is with frameStarted())
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 "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    SERVER,
29    CLIENT,
30    STANDALONE
31  };
32
33  class _OrxonoxExport Orxonox
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 createFrameListener();
68      void startRenderLoop();
69      void mainLoop();
70      void updateTimers(float);
71      float calculateEventTime(unsigned long, std::deque<unsigned long>&);
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      OIS::Keyboard*        keyboard_;
81      OIS::Mouse*           mouse_;
82      OIS::InputManager*    inputManager_;
83      OrxListener*          frameListener_;
84      Ogre::Root*           root_;
85      // TODO: make this a config-value by creating a config class for orxonox
86      float                 frameSmoothingTime_;
87      // little hack to actually show something dynamic in the HUD
88      HUD*                  orxonoxHUD_;
89      bool                  bAbort_;
90
91      // this is used to identify the mode (server/client/...) we're in
92      gameMode              mode_;
93      std::string           serverIp_;
94  };
95}
96#endif /* _Orxonox_H__ */
Note: See TracBrowser for help on using the repository browser.