Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

D:/Programming/GUI Editor (Source)/InputEngine.cpp

00001 #include "StdAfx.h" 00002 #include "InputEngine.h" 00003 00004 CInputEngine::CInputEngine() 00005 { 00006 m_pKeyboard = NULL; 00007 m_pMouse = NULL; 00008 // m_pGamepad = NULL; 00009 // m_pJoystick = NULL; 00010 00011 CGlobalLogger::GetSingleton().Write("Input Engine - Instantiated\n"); 00012 } 00013 00014 CInputEngine::~CInputEngine() 00015 { 00016 CGlobalLogger::GetSingleton().Write("Input Engine - Destroyed\n"); 00017 Destroy(); 00018 } 00019 00020 int CInputEngine::Create() 00021 { 00022 m_pMouse = new CMouse; 00023 m_pKeyboard = new CKeyboard; 00024 00025 #ifdef DIRECT_INPUT 00026 HRESULT Result = DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, 00027 IID_IDirectInput8, (VOID**)&g_pDI, NULL ); 00028 if(FAILED(Result)) 00029 return -1; 00030 #endif 00031 00032 m_pMouse->Create(); 00033 m_pKeyboard->Create(); 00034 00035 return 1; 00036 } 00037 00038 int CInputEngine::Poll() 00039 { 00040 if(m_pKeyboard !=NULL) 00041 m_pKeyboard->Poll(); 00042 00043 if(m_pMouse !=NULL) 00044 m_pMouse->Poll(); 00045 00046 return 1; 00047 } 00048 00049 CMouse *CInputEngine::GetMouse() 00050 { 00051 return m_pMouse; 00052 } 00053 00054 CKeyboard *CInputEngine::GetKeyboard() 00055 { 00056 return m_pKeyboard; 00057 } 00058 00059 void CInputEngine::Destroy() 00060 { 00061 SAFEDEL(m_pKeyboard) 00062 SAFEDEL(m_pMouse) 00063 // SAFEDEL(m_pGamepad) 00064 // SAFEDEL(m_pJoystick) 00065 00066 #ifdef DIRECT_INPUT 00067 if(g_pDI !=NULL) 00068 { 00069 g_pDI->Release(); 00070 g_pDI = NULL; 00071 } 00072 #endif 00073 } 00074 00075 bool CInputEngine::IsOfType(eEntityType eType) 00076 { 00077 if(eType == Entity_InputEngine) 00078 return true; 00079 00080 return CEntity::IsOfType(eType); 00081 }

Generated on Sun Jul 17 21:34:27 2005 for OpenGL GUI by doxygen 1.3.8