49 procedure aim(finger: Touch_Finger); |
49 procedure aim(finger: Touch_Finger); |
50 function isOnCrosshair(finger: Touch_Finger): boolean; |
50 function isOnCrosshair(finger: Touch_Finger): boolean; |
51 function isOnCurrentHog(finger: Touch_Finger): boolean; |
51 function isOnCurrentHog(finger: Touch_Finger): boolean; |
52 function isOnFireButton(finger: Touch_Finger): boolean; |
52 function isOnFireButton(finger: Touch_Finger): boolean; |
53 procedure convertToWorldCoord(var x,y: hwFloat; finger: Touch_Finger); |
53 procedure convertToWorldCoord(var x,y: hwFloat; finger: Touch_Finger); |
|
54 procedure convertToFingerCoord(var x,y: hwFloat; oldX, oldY: hwFloat); |
54 function fingerHasMoved(finger: Touch_Finger): boolean; |
55 function fingerHasMoved(finger: Touch_Finger): boolean; |
55 function calculateDelta(finger1, finger2: Touch_Finger): hwFloat; |
56 function calculateDelta(finger1, finger2: Touch_Finger): hwFloat; |
56 function getSecondFinger(finger: Touch_Finger): PTouch_Finger; |
57 function getSecondFinger(finger: Touch_Finger): PTouch_Finger; |
57 procedure printFinger(finger: Touch_Finger); |
58 procedure printFinger(finger: Touch_Finger); |
58 implementation |
59 implementation |
415 isOnFireButton:= (finger.x <= fireButtonRight) and (finger.x >= fireButtonLeft) and (finger.y <= fireButtonBottom) and (finger.y >= fireButtonTop); |
416 isOnFireButton:= (finger.x <= fireButtonRight) and (finger.x >= fireButtonLeft) and (finger.y <= fireButtonBottom) and (finger.y >= fireButtonTop); |
416 end; |
417 end; |
417 |
418 |
418 function isOnCrosshair(finger: Touch_Finger): boolean; |
419 function isOnCrosshair(finger: Touch_Finger): boolean; |
419 var |
420 var |
420 x,y,fingerX, fingerY : hwFloat; |
421 x,y : hwFloat; |
421 begin |
422 begin |
422 x := int2hwFloat(CrosshairX); |
423 convertToFingerCoord(x, y, int2hwFloat(CrosshairX), int2hwFloat(CrosshairY)); |
423 y := int2hwFloat(CrosshairY); |
424 isOnCrosshair:= Distance(int2hwFloat(finger.x)-x, int2hwFloat(finger.y)-y) < _50; |
424 |
|
425 convertToWorldCoord(fingerX, fingerY, finger); |
|
426 isOnCrosshair:= Distance(fingerX-x, fingerY-y) < _20; |
|
427 end; |
425 end; |
428 |
426 |
429 function isOnCurrentHog(finger: Touch_Finger): boolean; |
427 function isOnCurrentHog(finger: Touch_Finger): boolean; |
430 var |
428 var |
431 x,y, fingerX, fingerY : hwFloat; |
429 x,y : hwFloat; |
432 begin |
430 begin |
433 x := CurrentHedgehog^.Gear^.X; |
431 convertToFingerCoord(x, y, CurrentHedgehog^.Gear^.X, CurrentHedgehog^.Gear^.Y); |
434 y := CurrentHedgehog^.Gear^.Y; |
432 isOnCurrentHog := Distance(int2hwFloat(finger.X)-x, int2hwFloat(finger.Y)-y) < _50; |
435 |
433 end; |
436 convertToWorldCoord(fingerX, fingerY, finger); |
434 |
437 isOnCurrentHog := Distance(fingerX-x, fingerY-y) < _20; |
435 procedure convertToFingerCoord(var x,y : hwFloat; oldX, oldY: hwFloat); |
|
436 begin |
|
437 x := oldX + int2hwFloat(WorldDx + (cScreenWidth div 2)); |
|
438 y := oldY + int2hwFloat(WorldDy); |
438 end; |
439 end; |
439 |
440 |
440 procedure convertToWorldCoord(var x,y: hwFloat; finger: Touch_Finger); |
441 procedure convertToWorldCoord(var x,y: hwFloat; finger: Touch_Finger); |
441 begin |
442 begin |
442 //if x <> nil then |
443 //if x <> nil then |