00001 #include "StdAfx.h" 00002 #include "InputDeviceState.h" 00003 00004 CInputDeviceState::CInputDeviceState() 00005 { 00006 m_uipKeys = NULL; 00007 m_uiKeyCount = 0; 00008 00009 #ifdef DIRECT_INPUT 00010 m_pDIDevice = NULL; 00011 #endif 00012 } 00013 00014 CInputDeviceState::~CInputDeviceState() 00015 { 00016 Destroy(); 00017 } 00018 00019 UINT CInputDeviceState::GetKeyState(UINT uiKeyIndex) 00020 { 00021 if(m_uipKeys !=NULL) 00022 { 00023 if(uiKeyIndex >=0 && uiKeyIndex < m_uiKeyCount) 00024 return m_uipKeys[uiKeyIndex]; 00025 } 00026 00027 return 0; 00028 } 00029 00030 UINT CInputDeviceState::GetKeyCount() 00031 { 00032 return m_uiKeyCount; 00033 } 00034 00035 bool CInputDeviceState::IsKeyDown(UINT uiKey) 00036 { 00037 00038 return false; 00039 } 00040 00041 bool CInputDeviceState::IsKeyUp(UINT uiKey) 00042 { 00043 00044 return false; 00045 } 00046 00047 void CInputDeviceState::SetKeyState(UINT uiKey, UINT uiState) 00048 { 00049 if(uiKey >=0 && uiKey < 256) 00050 m_uipKeys[uiKey] = uiState; 00051 } 00052 00053 void CInputDeviceState::Destroy() 00054 { 00055 SAFEDEL(m_uipKeys) 00056 00057 #ifdef DIRECT_INPUT 00058 if(m_pDIDevice !=NULL) 00059 { 00060 m_pDIDevice->Release(); 00061 m_pDIDevice = NULL; 00062 } 00063 #endif 00064 }