Created
May 31, 2018 16:16
-
-
Save piotr-j/44918c0d53cf5cf7364efb4d54bc324d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| graphics.getView().setOnTouchListener(new View.OnTouchListener() { | |
| @Override public boolean onTouch (View view, MotionEvent event) { | |
| final int action = event.getAction() & MotionEvent.ACTION_MASK; | |
| int pointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT; | |
| switch (action) { | |
| case MotionEvent.ACTION_DOWN: | |
| case MotionEvent.ACTION_POINTER_DOWN: { | |
| Gdx.app.log("DOWN", pointerIndex + " -> " + event.getPressure(pointerIndex)); | |
| } break; | |
| case MotionEvent.ACTION_UP: | |
| case MotionEvent.ACTION_POINTER_UP: { | |
| Gdx.app.log("UP", pointerIndex + " -> " + event.getPressure(pointerIndex)); | |
| } break; | |
| case MotionEvent.ACTION_MOVE: { | |
| for (int i = 0, n = event.getPointerCount(); i < n; i++) { | |
| Gdx.app.log("MOVE", i + " -> " + event.getPressure(i)); | |
| } | |
| } break; | |
| } | |
| return true; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment