00001 
00002 
00003 
00004 
00005 
00006 #ifndef _GAME_H_
00007 #define _GAME_H_
00008 
00014 #include <IEventReceiver.h>
00015 
00016 class World;
00017 
00018 namespace irr
00019 {
00020     class IrrlichtDevice;
00021     
00022     namespace gui
00023     {
00024         class IGUIFont;
00025     }
00026 }
00027 
00028 namespace cAudio
00029 {
00030     class IAudioManager;
00031 }
00032 
00033 class Game : public irr::IEventReceiver
00034 {
00035     public:
00036         class State
00037         {
00038             public:
00039                 virtual ~State() {}
00040                 
00041                 virtual void enter() = 0;
00042                 virtual void leave() = 0;
00043                 
00044                 virtual void update(Game *g, irr::f32 dt) = 0;
00045                 
00046                 virtual bool event(const irr::SEvent& event) = 0;
00047                 
00048                 void changeState(State *s);
00049         };
00050         
00051         static Game* instance();
00052         
00053         Game();
00054         virtual ~Game();
00055         
00056         void run();
00057         void init(int argc, char **argv);
00058         
00059         virtual bool OnEvent(const irr::SEvent& e);
00060         
00061         World* getWorld() const;
00062         
00063         State* getState() const;
00064         void setState(State *s);
00065         
00066         irr::IrrlichtDevice* getDevice() const;
00067         
00068         cAudio::IAudioManager* getAudioManager() const;
00069         
00070     private:
00071         World *m_world;
00072         State *m_state;
00073         
00074         irr::gui::IGUIFont *m_font;
00075         irr::IrrlichtDevice *m_device;
00076         
00077         cAudio::IAudioManager *m_audio;
00078 };
00079 
00080 #endif