+ int action = AMotionEvent_getAction(event.aevent);
+ int action_pointer = (action&AMOTION_EVENT_ACTION_POINTER_INDEX_MASK)>>AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
+ action &= AMOTION_EVENT_ACTION_MASK;
+
+ int pointer_count = AMotionEvent_getPointerCount(event.aevent);
+ for(int i=0; i<pointer_count; ++i)
+ {
+ int pointer = AMotionEvent_getPointerId(event.aevent, i);
+ float x = AMotionEvent_getX(event.aevent, i);
+ float y = AMotionEvent_getY(event.aevent, i);
+ touch_move(pointer, x*2/window.get_width()-1, 1-y*2/window.get_height());
+ }
+
+ switch(action)
+ {
+ case AMOTION_EVENT_ACTION_DOWN:
+ case AMOTION_EVENT_ACTION_POINTER_DOWN:
+ touch_down(AMotionEvent_getPointerId(event.aevent, action_pointer));
+ break;
+ case AMOTION_EVENT_ACTION_UP:
+ case AMOTION_EVENT_ACTION_POINTER_UP:
+ touch_up(AMotionEvent_getPointerId(event.aevent, action_pointer));
+ break;
+ default:;
+ }