Replace tabs with spaces

This commit is contained in:
2015-09-01 13:15:14 +01:00
parent 45f730d9f3
commit c4948c1ff1
43 changed files with 2735 additions and 2735 deletions

View File

@@ -13,55 +13,55 @@ mhWnd( hWnd ),
mDeviceCounter( 0 )
{
for ( int i = 0; i < MAX_JXINPUTS; ++i )
{
mDevices[ i ] = NULL;
}
for ( int i = 0; i < MAX_JXINPUTS; ++i )
{
mDevices[ i ] = NULL;
}
if ( FAILED( InitDirectInput( hWnd ) ) )
{
FreeDirectInput();
}
if ( FAILED( InitDirectInput( hWnd ) ) )
{
FreeDirectInput();
}
}
JXInputManager::~JXInputManager()
{
for ( int i = 0; i < getNumberOfJXInputs(); ++i )
{
delete mDevices[ i ];
mDevices[ i ] = NULL;
}
for ( int i = 0; i < getNumberOfJXInputs(); ++i )
{
delete mDevices[ i ];
mDevices[ i ] = NULL;
}
FreeDirectInput();
FreeDirectInput();
}
int JXInputManager::getNumberOfJXInputs() const
{
return mDeviceCounter;
return mDeviceCounter;
}
JXInput& JXInputManager::getJXInput( int idx ) const
{
assert( idx < mDeviceCounter );
return * mDevices[ idx ];
assert( idx < mDeviceCounter );
return * mDevices[ idx ];
}
int JXInputManager::getMaxNumberOfAxes() const
{
return JXINPUT_MAX_AXES;
return JXINPUT_MAX_AXES;
}
int JXInputManager::getMaxNumberOfButtons() const
{
return JXINPUT_MAX_BUTTONS;
return JXINPUT_MAX_BUTTONS;
}
int JXInputManager::getMaxNumberOfDirectionals() const
{
return JXINPUT_MAX_DIRECTIONALS;
return JXINPUT_MAX_DIRECTIONALS;
}
@@ -87,7 +87,7 @@ HRESULT JXInputManager::InitDirectInput( HWND hWnd )
(VOID*)this, DIEDFL_ALLDEVICES /*| DIEDFL_INCLUDEPHANTOMS*/ ) ) )
return hr;
// Look for a other devices
// Look for a other devices
if( FAILED( hr = mpDI->EnumDevices( DI8DEVCLASS_DEVICE,
EnumJoysticksCallback,
(VOID*)this, DIEDFL_ALLDEVICES /*| DIEDFL_INCLUDEPHANTOMS*/ ) ) )
@@ -104,9 +104,9 @@ HRESULT JXInputManager::InitDirectInput( HWND hWnd )
HRESULT JXInputManager::FreeDirectInput()
{
if ( NULL != mpDI )
mpDI->Release();
mpDI = NULL;
if ( NULL != mpDI )
mpDI->Release();
mpDI = NULL;
return S_OK;
}
@@ -120,43 +120,43 @@ BOOL CALLBACK JXInputManager::EnumJoysticksCallback( const DIDEVICEINSTANCE* pdi
VOID* pContext )
{
HRESULT hr;
LPDIRECTINPUTDEVICE8 pJoystick;
LPDIRECTINPUTDEVICE8 pJoystick;
JXInputManager* pThis = (JXInputManager*)pContext;
JXInputManager* pThis = (JXInputManager*)pContext;
//
// if the maximum number of devices is already registered,
// issue a warning and stop enumeration.
//
if( MAX_JXINPUTS == pThis->mDeviceCounter )
{
OutputDebugString( "Max. number of devices exceeded!" );
return DIENUM_STOP;
}
//
// if the maximum number of devices is already registered,
// issue a warning and stop enumeration.
//
if( MAX_JXINPUTS == pThis->mDeviceCounter )
{
OutputDebugString( "Max. number of devices exceeded!" );
return DIENUM_STOP;
}
// Obtain an interface to the enumerated joystick.
hr = pThis->mpDI->CreateDevice( pdidInstance->guidInstance, &pJoystick, NULL );
hr = pThis->mpDI->CreateDevice( pdidInstance->guidInstance, &pJoystick, NULL );
// If it failed, then we can't use this joystick. (Maybe the user unplugged
// it while we were in the middle of enumerating it.)
if( FAILED(hr) )
return DIENUM_CONTINUE;
JXInput* pJ = new JXInput( pJoystick, pThis->mhWnd );
JXInput* pJ = new JXInput( pJoystick, pThis->mhWnd );
//
// only register useful devices
//
if( pJ->getNumberOfAxes() + pJ->getNumberOfButtons() + pJ->getNumberOfDirectionals() > 0 )
{
pThis->addJXInput( pJ );
}
else
{
delete pJ;
}
//
// only register useful devices
//
if( pJ->getNumberOfAxes() + pJ->getNumberOfButtons() + pJ->getNumberOfDirectionals() > 0 )
{
pThis->addJXInput( pJ );
}
else
{
delete pJ;
}
return DIENUM_CONTINUE;
}
@@ -167,8 +167,8 @@ BOOL CALLBACK JXInputManager::EnumJoysticksCallback( const DIDEVICEINSTANCE* pdi
*/
void JXInputManager::addJXInput( JXInput* pJ )
{
assert( mDeviceCounter < MAX_JXINPUTS );
assert( mDeviceCounter < MAX_JXINPUTS );
if( mDeviceCounter < MAX_JXINPUTS )
mDevices[ mDeviceCounter++ ] = pJ;
if( mDeviceCounter < MAX_JXINPUTS )
mDevices[ mDeviceCounter++ ] = pJ;
}