hedgewars/uTouch.pas
changeset 6950 f34ff54b0cbd
parent 6949 615cc50903c8
child 6951 a37e470c8694
--- a/hedgewars/uTouch.pas	Fri Apr 27 23:39:01 2012 +0200
+++ b/hedgewars/uTouch.pas	Sat Apr 28 12:46:57 2012 +0200
@@ -59,7 +59,6 @@
 
 const
     clickTime = 200;
-    longClickTime = 400;
     nilFingerId = High(TSDL_FingerId);
 
 var
@@ -216,10 +215,12 @@
 finger:= updateFinger(x,y,0,0,pointerId);
 //Check for onTouchClick event
 if not(fingerHasMoved(finger^)) then
+    begin
     if (RealTicks - finger^.timeSinceDown) < clickTime then
         onTouchClick(finger^)
     else
-        onTouchLongClick(finger^);
+            onTouchLongClick(finger^);
+    end;
 
 if aimingCrosshair then
     begin
@@ -262,8 +263,15 @@
 procedure onTouchLongClick(finger: TTouch_Data);
 begin
 {$IFDEF USE_TOUCH_INTERFACE}
+WriteLnToConsole('blabla');
 if isOnWidget(jumpWidget, finger) then
+    begin
     ParseTeamCommand('ljump');
+    exit;
+    end;
+
+if (CurrentHedgehog <> nil) and (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0)then
+    ParseTeamCommand('put');
 {$ENDIF}
 end;
 
@@ -541,7 +549,8 @@
 //Method to calculate the distance this finger has moved since the downEvent
 function fingerHasMoved(finger: TTouch_Data): boolean;
 begin
-    fingerHasMoved := trunc(sqrt(sqr(finger.X-finger.historicalX) + sqr(finger.y-finger.historicalY))) > 330;
+    fingerHasMoved := trunc(sqrt(sqr(finger.X-finger.historicalX) + sqr(finger.y-finger.historicalY))) > 30;
+    WriteLnToConsole(inttostr(ord(fingerHasMoved)) + ' xy' + inttostr(finger.x) + ' ' + inttostr(finger.historicalx));
 end;
 
 function calculateDelta(finger1, finger2: TTouch_Data): LongInt; inline;