hedgewars/uCursor.pas
branchwebgl
changeset 8444 75db7bb8dce8
parent 8330 aaefa587e277
parent 8346 3443e0de2c9d
child 10015 4feced261c68
equal deleted inserted replaced
8340:46a9fde631f4 8444:75db7bb8dce8
     3 interface
     3 interface
     4 
     4 
     5 procedure init;
     5 procedure init;
     6 procedure resetPosition;
     6 procedure resetPosition;
     7 procedure updatePosition;
     7 procedure updatePosition;
       
     8 procedure handlePositionUpdate(x, y: LongInt);
     8 
     9 
     9 implementation
    10 implementation
    10 
    11 
    11 uses SDLh, uVariables;
    12 uses SDLh, uVariables;
    12 
    13 
    38     x := x + offsetx;
    39     x := x + offsetx;
    39     y := y + offsety;
    40     y := y + offsety;
    40 {$ENDIF}
    41 {$ENDIF}
    41 
    42 
    42     if(x <> cScreenWidth div 2) or (y <> cScreenHeight div 2) then
    43     if(x <> cScreenWidth div 2) or (y <> cScreenHeight div 2) then
    43         begin
    44     begin
    44         CursorPoint.X:= CursorPoint.X + x - cScreenWidth div 2;
    45         handlePositionUpdate(x - cScreenWidth div 2, y - cScreenHeight div 2);
    45         CursorPoint.Y:= CursorPoint.Y - y + cScreenHeight div 2;
       
    46 
    46 
    47         if cHasFocus then
    47         if cHasFocus then
    48             begin
    48             begin
    49             {$IFNDEF WEBGL}
    49             {$IFNDEF WEBGL}
    50             SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
    50             SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
    54             {$ENDIF}
    54             {$ENDIF}
    55             end;
    55             end;
    56         end
    56         end
    57 end;
    57 end;
    58 
    58 
       
    59 procedure handlePositionUpdate(x, y: LongInt);
       
    60 begin
       
    61     CursorPoint.X:= CursorPoint.X + x;
       
    62     CursorPoint.Y:= CursorPoint.Y - y;
       
    63 end;
       
    64 
    59 end.
    65 end.