//---------------------------------------------------------------------------- // Laser Guard Ltd. // Copyright © 2000-2002. All Rights Reserved. // Version 1.0 01/01/2000 // Last modification: 08/10/2003 // PROJECT: // SUBSYSTEM: // FILE: DirectInputSet.cpp // AUTHOR: Sergey Chizhevskiy // OVERVIEW // ~~~~~~~~ // Source file of DirectInputSet.cpp //---------------------------------------------------------------------------- #include "stdafx.h" #include "DirectInputSet.h" #include "..\..\LgLib\Version.h" CDirectInputSet::CDirectInputSet() { m_ppInput = NULL; m_nInput = 0; } CDirectInputSet::~CDirectInputSet() { if( m_ppInput ) { for( int i = 0; i < m_nInput; i++ ) delete m_ppInput[i]; free( m_ppInput ); } } void CDirectInputSet::Reset() { for( int i = 0; i < m_nInput; i++ ) m_ppInput[i]->CmdReset(); } BOOL CDirectInputSet::ConnectToDevice( CDeviceDI *pDeviceDI, int nDeviceBit, int nSensorBit ) { CDirectInput *pDirectInput = new CDirectInput; if( !pDirectInput ) return FALSE; m_ppInput = (CDirectInput**)realloc( m_ppInput, sizeof(CDirectInput*) * (m_nInput + 1) ); if( !m_ppInput ) { m_nInput = 0; delete pDirectInput; return FALSE; } m_ppInput[ m_nInput ] = pDirectInput; return m_ppInput[ m_nInput++ ]->ConnectToDevice( pDeviceDI, nDeviceBit, nSensorBit ); }