# HG changeset patch # User Xeli # Date 1313838453 -7200 # Node ID 88f43becefe3413dc68fb3ed5d9d00365faf3387 # Parent 104f69e798bbe8d19387ec879090ebb1a32f083e added low jump, you can low-jump by double tapping the right or left side of the screen diff -r 104f69e798bb -r 88f43becefe3 hedgewars/uTouch.pas --- a/hedgewars/uTouch.pas Fri Aug 19 22:40:13 2011 +0200 +++ b/hedgewars/uTouch.pas Sat Aug 20 13:07:33 2011 +0200 @@ -16,7 +16,6 @@ procedure initModule; - procedure ProcessTouch; procedure onTouchDown(x,y: Longword; pointerId: SDL_FingerId); procedure onTouchMotion(x,y: Longword; dx,dy: LongInt; pointerId: SDL_FingerId); @@ -25,6 +24,7 @@ function addFinger(x,y: Longword; id: SDL_FingerId): Touch_Finger; procedure deleteFinger(id: SDL_FingerId); procedure onTouchClick(finger: Touch_Finger); +procedure onTouchDoubleClick(finger: Touch_Finger); function findFinger(id: SDL_FingerId): Touch_Finger; procedure aim(finger: Touch_Finger); @@ -47,18 +47,20 @@ pointerCount : Longword; fingers: array of Touch_Finger; moveCursor : boolean; + invertCursor : boolean; + + xTouchClick,yTouchClick : LongInt; + timeSinceClick : Longword; //Pinch to zoom pinchSize : hwFloat; baseZoomValue: GLFloat; - invertCursor : boolean; //aiming aiming, movingCrosshair: boolean; crosshairCommand: ShortString; targetAngle: LongInt; - stopFiring: boolean; //moving @@ -190,8 +192,25 @@ end; end; +procedure onTouchDoubleClick(finger: Touch_Finger); +begin + ParseCommand('ljump', true); +end; + procedure onTouchClick(finger: Touch_Finger); begin + if (SDL_GetTicks - timeSinceClick < 300) and (DistanceI(finger.X-xTouchClick, finger.Y-yTouchClick) < _30) then + begin + onTouchDoubleClick(finger); + exit; + end + else + begin + xTouchClick := finger.x; + yTouchClick := finger.y; + timeSinceClick := SDL_GetTicks; + end; + if bShowAmmoMenu then begin doPut(CursorPoint.X, CursorPoint.Y, false);