Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.4 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: DirectInputSet.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of DirectInputSet.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "DirectInputSet.h"
  16. #include "..\..\LgLib\Version.h"
  17. CDirectInputSet::CDirectInputSet()
  18. {
  19. m_ppInput = NULL;
  20. m_nInput = 0;
  21. }
  22. CDirectInputSet::~CDirectInputSet()
  23. {
  24. if( m_ppInput )
  25. {
  26. for( int i = 0; i < m_nInput; i++ )
  27. delete m_ppInput[i];
  28. free( m_ppInput );
  29. }
  30. }
  31. void CDirectInputSet::Reset()
  32. {
  33. for( int i = 0; i < m_nInput; i++ )
  34. m_ppInput[i]->CmdReset();
  35. }
  36. BOOL CDirectInputSet::ConnectToDevice( CDeviceDI *pDeviceDI, int nDeviceBit, int nSensorBit )
  37. {
  38. CDirectInput *pDirectInput = new CDirectInput;
  39. if( !pDirectInput )
  40. return FALSE;
  41. m_ppInput = (CDirectInput**)realloc( m_ppInput, sizeof(CDirectInput*) * (m_nInput + 1) );
  42. if( !m_ppInput )
  43. {
  44. m_nInput = 0;
  45. delete pDirectInput;
  46. return FALSE;
  47. }
  48. m_ppInput[ m_nInput ] = pDirectInput;
  49. return m_ppInput[ m_nInput++ ]->ConnectToDevice( pDeviceDI, nDeviceBit, nSensorBit );
  50. }