[joystickcls] GetLastChange button diffs

Ensure that when generating changes between the last joystick state and
the current one that we actually compare button states.

This causes another bug with the joystick axis frequently becoming
selected, which will be fixed in a further commit
This commit is contained in:
standardtoaster 2014-06-22 11:41:36 -07:00
parent 0c1833451b
commit c87eed91ec

View File

@ -219,8 +219,10 @@ public String GetLastChange( )
if ( pov[3] >= 0 ) if ( pov[3] != ppov[3] ) m_lastItem = "hat4_" + HatDir( pov[0] ); if ( pov[3] >= 0 ) if ( pov[3] != ppov[3] ) m_lastItem = "hat4_" + HatDir( pov[0] );
bool[] buttons = m_state.Buttons; bool[] buttons = m_state.Buttons;
bool[] prevButtons = m_prevState.Buttons;
for ( int bi=0; bi < buttons.Length; bi++ ) { for ( int bi=0; bi < buttons.Length; bi++ ) {
if ( buttons[bi] ) m_lastItem = "button" + ( bi + 1 ).ToString( ); if ( buttons[bi] && buttons[bi] != prevButtons[bi])
m_lastItem = "button" + ( bi + 1 ).ToString( );
} }
return m_lastItem; return m_lastItem;
} }