Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

SCA_ISystem.h

Go to the documentation of this file.
00001 
00006 
00007 #ifndef __KX_ISYSTEM
00008 #define __KX_ISYSTEM
00009 
00010 #include <vector>
00011 using namespace std;
00012 
00013 #include "SCA_IInputDevice.h"
00014 
00018 
00019 class SCA_IMainLoop
00020 {
00021 public:
00022         virtual int MainLoopCallback()=0;
00023 };
00024 
00028 
00029 class SCA_ISystem
00030 {
00031 
00032 protected:
00033         bool                                            m_exitrequested;
00034 
00035         std::vector<SCA_IInputDevice*>  m_inputDevices;
00036 
00037         int                             m_keyboardDeviceIndex;
00038         int                             m_mouseDeviceIndex;
00039 
00040         SCA_IMainLoop*          m_mainloopobj;
00041 
00042 public:
00043         SCA_ISystem() 
00044                 : m_exitrequested(false),
00045                 m_keyboardDeviceIndex(-1),
00046                 m_mouseDeviceIndex(-1)

00047                 

00048         {
00049         };
00050         virtual ~SCA_ISystem() {
00051         };
00052 
00053         void            AddInputDevice(SCA_IInputDevice* inputdev)

00054         {
00055                 m_inputDevices.push_back(inputdev);
00056         }
00057 
00058         void            SetKeyboardDevice(SCA_IInputDevice* inputdev)

00059         {
00060                 m_keyboardDeviceIndex = m_inputDevices.size();
00061                 AddInputDevice(inputdev);
00062         }
00063 
00064         virtual SCA_IInputDevice* GetKeyboardDevice()

00065         {
00066                 return (m_keyboardDeviceIndex >= 0 ?  
00067                         m_inputDevices[m_keyboardDeviceIndex]: 
00068                         NULL);
00069         }
00070 
00071         void    SetMouseDevice(SCA_IInputDevice* inputdev)

00072         {
00073                 m_mouseDeviceIndex = m_inputDevices.size();
00074                 AddInputDevice(inputdev);
00075         }
00076 
00077         virtual SCA_IInputDevice* GetMouseDevice()

00078         {
00079                 return (m_mouseDeviceIndex >= 0 ?  
00080                         m_inputDevices[m_mouseDeviceIndex]: 
00081                         NULL);
00082         }
00083 
00084 
00085 
00086         void                    SetMainLoop(SCA_IMainLoop* mainloop) { 
00087                 m_mainloopobj = mainloop;
00088         };
00089         void                    DoMainLoopCallback()

00090         {
00091                 m_mainloopobj->MainLoopCallback();
00092         };
00093         virtual void    StartMainLoop()=0;
00094         virtual void    NextFrame()=0;
00095         virtual double GetTimeInSeconds()=0;
00096         virtual void Sleep(int millisec)=0;
00097         bool    IsExitRequested() { return m_exitrequested;};
00098 
00099 };
00100 
00101 
00102 SCA_ISystem* NewKX_System();
00103 
00104 #endif

Generated at Thu Feb 1 13:03:10 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000