// Make sure the mouse has been initialized
if( !m_bInitialized )
return FALSE;
// Get the state of the mouse into the key buffer
r = m_pMouse->GetDeviceState( sizeof(DIMOUSESTATE2), &m_dims2 );
if( FAILED( r ) )
{
// If the device is not acquired...
if( r == DIERR_INPUTLOST || r == DIERR_NOTACQUIRED)
{
// ...then reacquire the device
while( r == DIERR_INPUTLOST || r == DIERR_NOTACQUIRED)
r = m_pMouse->Acquire();
if( SUCCEEDED( r ) )
m_pMouse->GetDeviceState( sizeof(DIMOUSESTATE2), &m_dims2 );
else
return FALSE;
}
else
// ...Otherwise it was some other error
return FALSE;
}
// Check if the mouse was clicked
if( key & 0x80 )
return TRUE;
else
return FALSE;
sorry for the double post :\
Mouse clicking problem...
I''m using Direct Input 8 to check the mouse for left clicks in my game for the purpose of navigating through a selection of menu screens. The problem I''m having is that when one button is clicked and the screen loads the next option menu, the button below that gets clicked too as the input is checked again and the mouse is still registered as being pressed. Is there a good way to reset the state of the mouse after each check so this doesnt happen?
Cheers
Dave
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement