47 private boolean firstEvent = true; |
47 private boolean firstEvent = true; |
48 |
48 |
49 public boolean onTouch(View v, MotionEvent event) { |
49 public boolean onTouch(View v, MotionEvent event) { |
50 //dumpEvent(event); |
50 //dumpEvent(event); |
51 |
51 |
52 if(firstEvent){ |
|
53 firstEvent = false; |
|
54 SDLActivity.onNativeTouch(-1, -1, v.getWidth(), v.getHeight(), 1); |
|
55 } |
|
56 |
|
57 int action = event.getAction(); |
52 int action = event.getAction(); |
58 int actionCode = action & MotionEvent.ACTION_MASK; |
53 int actionCode = action & MotionEvent.ACTION_MASK; |
59 |
54 |
60 for (int i = 0; i < event.getPointerCount(); i++) { |
55 for (int i = 0; i < event.getPointerCount(); i++) { |
61 SDLActivity.onNativeTouch(actionCode, event.getPointerId(i), (int)event.getX(i), (int)event.getY(i), event.getPressure(i)); |
56 SDLActivity.onNativeTouch(event.getDeviceId(), event.getPointerId(i), actionCode, (int)event.getX(i), (int)event.getY(i), event.getPressure(i)); |
62 // Log.d("Android", String.format("x=%f, y=%f, pntr=%d", event.getX(i), event.getY(i), event.getPointerId(i))); |
57 // Log.d("Android", String.format("x=%f, y=%f, pntr=%d", event.getX(i), event.getY(i), event.getPointerId(i))); |
63 } |
58 } |
64 return true; |
59 return true; |
65 } |
60 } |
66 |
61 |