hedgewars/uTouch.pas
changeset 6705 d2e95dcf2bb0
parent 6704 77c93096d055
child 6707 07c8704b6b08
equal deleted inserted replaced
6704:77c93096d055 6705:d2e95dcf2bb0
   118     exit;
   118     exit;
   119     end;
   119     end;
   120 if isOnRect(arrowUp.active, finger^) then
   120 if isOnRect(arrowUp.active, finger^) then
   121      begin
   121      begin
   122      upKey:= true;
   122      upKey:= true;
   123      aimingUp:= true;
       
   124      moveCursor:= false;
   123      moveCursor:= false;
   125      finger^.pressedWidget:= @arrowUp;
   124      finger^.pressedWidget:= @arrowUp;
   126      exit;
   125      exit;
   127      end;
   126      end;
   128 if isOnRect(arrowDown.active, finger^) then
   127 if isOnRect(arrowDown.active, finger^) then
   129      begin
   128      begin
   130      downKey:= true;
   129      downKey:= true;
   131      aimingDown:= true;
       
   132      moveCursor:= false;
   130      moveCursor:= false;
   133      finger^.pressedWidget:= @arrowDown;
   131      finger^.pressedWidget:= @arrowDown;
   134      exit;
   132      exit;
   135      end;
   133      end;
   136 
   134 
   226 WriteToConsole(Format('%d', [buttonsDown]));
   224 WriteToConsole(Format('%d', [buttonsDown]));
   227 
   225 
   228 if aimingCrosshair then
   226 if aimingCrosshair then
   229     begin
   227     begin
   230     aimingCrosshair:= false;
   228     aimingCrosshair:= false;
       
   229     upKey:= false;
       
   230     downKey:= false;
   231     dec(buttonsDown);
   231     dec(buttonsDown);
   232     end;
   232     end;
   233 
   233 
   234 widget:= finger^.pressedWidget;
   234 widget:= finger^.pressedWidget;
   235 if (buttonsDown > 0) and (widget <> nil) then
   235 if (buttonsDown > 0) and (widget <> nil) then
   376 procedure ProcessTouch;
   376 procedure ProcessTouch;
   377 var
   377 var
   378     deltaAngle: LongInt;
   378     deltaAngle: LongInt;
   379 begin
   379 begin
   380 invertCursor := not(bShowAmmoMenu);
   380 invertCursor := not(bShowAmmoMenu);
   381 if aimingCrosshair or aimingUp or aimingDown then
   381 if aimingCrosshair then
   382     if CurrentHedgehog^.Gear <> nil then
   382     if CurrentHedgehog^.Gear <> nil then
   383         begin
   383         begin
   384         deltaAngle:= CurrentHedgehog^.Gear^.Angle - targetAngle;
   384         deltaAngle:= CurrentHedgehog^.Gear^.Angle - targetAngle;
   385         if (deltaAngle = 0) then 
   385         if (deltaAngle > -5) and (deltaAngle < 5) then 
   386             begin
   386             begin
   387             if aimingUp then
       
   388                 begin
       
   389                 upKey:= false;
   387                 upKey:= false;
   390                 aimingUp:= false;
   388                 aimingUp:= false;
   391                 end;
       
   392             if aimingDown then
       
   393                 begin
       
   394                 downKey:= false;
   389                 downKey:= false;
   395                 aimingDown:= false;
   390                 aimingDown:= false;
   396                 end
       
   397             end
   391             end
   398         else
   392         else
   399             begin
   393             begin
   400             if (deltaAngle < 0) then
   394             if (deltaAngle < 0) then
   401                 begin
   395                 begin