--- a/hedgewars/uTouch.pas Fri Aug 19 22:31:59 2011 +0200
+++ b/hedgewars/uTouch.pas Fri Aug 19 22:40:13 2011 +0200
@@ -28,6 +28,7 @@
function findFinger(id: SDL_FingerId): Touch_Finger;
procedure aim(finger: Touch_Finger);
+function isOnCrosshair(finger: Touch_Finger): boolean;
function isOnCurrentHog(finger: Touch_Finger): boolean;
function isOnFireButton(finger: Touch_Finger): boolean;
procedure convertToWorldCoord(var x,y: hwFloat; finger: Touch_Finger);
@@ -87,7 +88,7 @@
exit;
end;
- if isOnCurrentHog(finger) then
+ if isOnCrosshair(finger) then
begin
aiming:= true;
exit;
@@ -358,6 +359,17 @@
isOnFireButton:= (finger.x < 150) and (finger.y > 390);
end;
+function isOnCrosshair(finger: Touch_Finger): boolean;
+var
+ x,y,fingerX, fingerY : hwFloat;
+begin
+ x := int2hwFloat(CrosshairX);
+ y := int2hwFloat(CrosshairY);
+
+ convertToWorldCoord(fingerX, fingerY, finger);
+ isOnCrosshair:= Distance(fingerX-x, fingerY-y) < _20;
+end;
+
function isOnCurrentHog(finger: Touch_Finger): boolean;
var
x,y, fingerX, fingerY : hwFloat;