Release button after touch leaves boundaries

Now, your finger can still move around, but as soon as it leaves the button boundaries the button is released.
This commit is contained in:
Sean 2014-04-21 22:59:08 -04:00
parent 72f3d69a78
commit f489e30cd8
1 changed files with 2 additions and 0 deletions

View File

@ -123,6 +123,8 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
{ {
if (button.getBounds().contains((int)event.getX(), (int)event.getY())) if (button.getBounds().contains((int)event.getX(), (int)event.getY()))
NativeLibrary.onTouchEvent(0, button.getId(), buttonState); NativeLibrary.onTouchEvent(0, button.getId(), buttonState);
else // Release button after touch leaves boundaries
NativeLibrary.onTouchEvent(0, button.getId(), ButtonState.RELEASED);
} }