hedgewars/uTouch.pas
changeset 6704 77c93096d055
parent 6703 abe2abfe9de2
child 6705 d2e95dcf2bb0
equal deleted inserted replaced
6703:abe2abfe9de2 6704:77c93096d055
    20 
    20 
    21 unit uTouch;
    21 unit uTouch;
    22 
    22 
    23 interface
    23 interface
    24 
    24 
    25 uses sysutils, math, uConsole, uVariables, SDLh, uFloat, uConsts, uIO, GLUnit, uTypes;
    25 uses sysutils, uConsole, uVariables, SDLh, uFloat, uConsts, uIO, GLUnit, uTypes;
    26 
    26 
    27 
    27 
    28 procedure initModule;
    28 procedure initModule;
    29 
    29 
    30 procedure ProcessTouch;
    30 procedure ProcessTouch;
   525 end;
   525 end;
   526 
   526 
   527 //Method to calculate the distance this finger has moved since the downEvent
   527 //Method to calculate the distance this finger has moved since the downEvent
   528 function fingerHasMoved(finger: TTouch_Data): boolean;
   528 function fingerHasMoved(finger: TTouch_Data): boolean;
   529 begin
   529 begin
   530     fingerHasMoved := trunc(sqrt(Power(finger.X-finger.historicalX,2) + Power(finger.y-finger.historicalY, 2))) > 330;
   530     fingerHasMoved := trunc(sqrt(sqr(finger.X-finger.historicalX) + sqr(finger.y-finger.historicalY))) > 330;
   531 end;
   531 end;
   532 
   532 
   533 function calculateDelta(finger1, finger2: TTouch_Data): LongInt; inline;
   533 function calculateDelta(finger1, finger2: TTouch_Data): LongInt; inline;
   534 begin
   534 begin
   535     calculateDelta := Round(sqrt(sqr(finger2.x-finger1.x) + sqr(finger2.y-finger1.y)));
   535     calculateDelta := Round(sqrt(sqr(finger2.x-finger1.x) + sqr(finger2.y-finger1.y)));