Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core2/src/orxonox/Orxonox.h @ 993

Last change on this file since 993 was 993, checked in by landauf, 16 years ago
  • added exit command: quits orxonox (no, it's not a hidden segfault :D)
  • added exec command: executes files (that contain other commands)

funny: use the log function to write commands into orxonox.log and then use 'exec orxonox.log' - it works. I've even added a recursion-blocker to avoid an (almost) endless loop after logging 'exec orxonox.log' ;)

I'm currently thinking about more complex commands (what about delayed commands? or commands with returnvalue and a pipeline symbol?).

File size: 2.9 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 "loader/LoaderPrereqs.h"
17//#include "audio/AudioPrereqs.h"
18
19#include "GraphicsEngine.h"
20
21
22// TODO: Orxonox should maybe derive from BaseObject
23//! Orxonox singleton class
24namespace orxonox {
25
26  enum gameMode{
27    STANDALONE,
28    SERVER,
29    CLIENT,
30    PRESENTATION
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      static Orxonox* getSingleton();
41      inline Ogre::SceneManager* getSceneManager()         { return ogre_->getSceneManager(); };
42      inline GraphicsEngine* getOgrePointer()              { return ogre_; };
43//      inline audio::AudioManager* getAudioManagerPointer() { return auMan_; };
44      inline OIS::Keyboard* getKeyboard()                  { return this->keyboard_; }
45      inline OIS::Mouse* getMouse()                        { return this->mouse_; }
46//      inline BulletManager* getBulletMgr()                 { return this->bulletMgr_; }
47      static inline void exit()                            { Orxonox::getSingleton()->bExit_ = true; }
48      inline bool shouldExit()                             { return this->bExit_; }
49
50    private:
51      Orxonox();
52      virtual ~Orxonox();
53      // init functions
54      void serverInit(std::string path);
55      void clientInit(std::string path);
56      void standaloneInit(std::string path);
57      // run functions
58      void playableServer(std::string path);
59      void standalone();
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
70    private:
71      GraphicsEngine*       ogre_;          //!< our dearest graphics engine <3
72      std::string           dataPath_;      //!< path to data
73//      loader::LevelLoader*  loader_;        //!< level loader builds the scene
74//      audio::AudioManager*  auMan_;         //!< audio manager
75//      BulletManager*        bulletMgr_;     //!< Keeps track of the thrown bullets
76      static Orxonox*       singletonRef_;
77      OIS::Keyboard*        keyboard_;
78      OIS::Mouse*           mouse_;
79      OIS::InputManager*    inputManager_;
80      OrxListener*          frameListener_;
81      Ogre::Root*           root_;
82      bool                  bExit_;
83
84      // this is used to identify the mode (server/client/...) we're in
85      gameMode              mode_;
86      std::string           serverIp_;
87  };
88}
89#endif /* _Orxonox_H__ */
Note: See TracBrowser for help on using the repository browser.