project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/TouchInterface/TouchInterface.java
branchhedgeroid
changeset 6332 5d9cc2441c48
parent 6047 10011f051f9c
equal deleted inserted replaced
6330:1bde8940e1bb 6332:5d9cc2441c48
    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