Fixed hardware mouse detection, fixed Ballfield example

This commit is contained in:
pelya
2012-02-01 12:53:25 +02:00
parent c6489923f7
commit d8e16a2b4f
2 changed files with 31 additions and 13 deletions

View File

@@ -226,8 +226,27 @@ abstract class DifferentTouchInput
if( touchEvents[id].down )
action = Mouse.SDL_FINGER_MOVE;
else
action = Mouse.SDL_FINGER_HOVER; //action = Mouse.SDL_FINGER_DOWN;
//touchEvents[id].down = true;
action = Mouse.SDL_FINGER_HOVER;
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB_MR1 )
{
// Noneycomb has no excuse for sending such hackish mouse events, it has a dedicated ACTION_HOVER_MOVE event
action = Mouse.SDL_FINGER_DOWN;
touchEvents[id].down = true;
}
else
{
// Beagleboard with Android 2.3.3 sends ACTION_MOVE for USB mouse movements, without sending ACTION_DOWN first
// So we're guessing if we have Android 2.X and USB mouse, if there are no other fingers touching the screen
for( int iii = 0; iii < touchEventMax; iii++ )
{
if( touchEvents[iii].down )
{
action = Mouse.SDL_FINGER_DOWN;
touchEvents[id].down = true;
break;
}
}
}
touchEvents[id].x = (int)event.getX(ii);
touchEvents[id].y = (int)event.getY(ii);
touchEvents[id].pressure = (int)(event.getPressure(ii) * 1000.0);