hedgewars/uCursor.pas
changeset 13498 424944a835a7
parent 12831 1fbc0d5a82d0
child 14305 a3531b520efb
equal deleted inserted replaced
13497:3bb07c847886 13498:424944a835a7
     7 procedure updatePosition;
     7 procedure updatePosition;
     8 procedure handlePositionUpdate(x, y: LongInt);
     8 procedure handlePositionUpdate(x, y: LongInt);
     9 
     9 
    10 implementation
    10 implementation
    11 
    11 
    12 uses SDLh, uVariables;
    12 uses SDLh, uVariables, uTypes;
    13 
    13 
    14 procedure init;
    14 procedure init;
    15 begin
    15 begin
    16     resetPosition();
    16     resetPosition();
    17 end;
    17 end;
    18 
    18 
    19 procedure resetPosition;
    19 procedure resetPosition;
    20 begin
    20 begin
       
    21     if GameType = gmtRecord then
       
    22         exit;
    21     // Move curser by 1px in case it's already centered.
    23     // Move curser by 1px in case it's already centered.
    22     // The game camera in the Alpha for 0.9.23 screwed up if
    24     // The game camera in the Alpha for 0.9.23 screwed up if
    23     // the game started with the mouse already being centered.
    25     // the game started with the mouse already being centered.
    24     // This fixes it, but we might have overlooked a related
    26     // This fixes it, but we might have overlooked a related
    25     // bug somewhere else.
    27     // bug somewhere else.
    29 end;
    31 end;
    30 
    32 
    31 procedure updatePosition;
    33 procedure updatePosition;
    32 var x, y: LongInt;
    34 var x, y: LongInt;
    33 begin
    35 begin
    34     SDL_GetMouseState(@x, @y);
    36     if GameType <> gmtRecord then
       
    37         SDL_GetMouseState(@x, @y);
    35 
    38 
    36     if(x <> cScreenWidth div 2) or (y <> cScreenHeight div 2) then
    39     if(x <> cScreenWidth div 2) or (y <> cScreenHeight div 2) then
    37     begin
    40     begin
    38         handlePositionUpdate(x - cScreenWidth div 2, y - cScreenHeight div 2);
    41         handlePositionUpdate(x - cScreenWidth div 2, y - cScreenHeight div 2);
    39 
    42 
    40         if cHasFocus then
    43         if cHasFocus and (GameType <> gmtRecord) then
    41             SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
    44             SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
    42     end
    45     end
    43 end;
    46 end;
    44 
    47 
    45 procedure handlePositionUpdate(x, y: LongInt);
    48 procedure handlePositionUpdate(x, y: LongInt);