hedgewars/uWorld.pas
changeset 14808 9443dc6663ba
parent 14766 cbdfc5b1d5b8
child 14809 c2793ff4e887
equal deleted inserted replaced
14807:b2beb784e4b5 14808:9443dc6663ba
  1972     if CursorPoint.Y > cScreenHeight - AmmoRect.y -amNumOffsetY - 1 then//check top
  1972     if CursorPoint.Y > cScreenHeight - AmmoRect.y -amNumOffsetY - 1 then//check top
  1973         CursorPoint.Y:= cScreenHeight - AmmoRect.y - amNumOffsetY - 1;
  1973         CursorPoint.Y:= cScreenHeight - AmmoRect.y - amNumOffsetY - 1;
  1974     if CursorPoint.Y < cScreenHeight - (AmmoRect.y + AmmoRect.h - AMSlotSize - 5) then//check bottom
  1974     if CursorPoint.Y < cScreenHeight - (AmmoRect.y + AmmoRect.h - AMSlotSize - 5) then//check bottom
  1975         CursorPoint.Y:= cScreenHeight - (AmmoRect.y + AmmoRect.h - AMSlotSize - 5);
  1975         CursorPoint.Y:= cScreenHeight - (AmmoRect.y + AmmoRect.h - AMSlotSize - 5);
  1976     prevPoint:= CursorPoint;
  1976     prevPoint:= CursorPoint;
  1977     //if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y);
       
  1978     exit
  1977     exit
  1979 end;
  1978 end;
  1980 
  1979 
  1981 if isCursorVisible then
  1980 if isCursorVisible then
  1982     begin
  1981     begin
  2028         CursorPoint.Y:= cScreenHeight div 2;
  2027         CursorPoint.Y:= cScreenHeight div 2;
  2029         end;
  2028         end;
  2030 
  2029 
  2031 // this moves the camera according to CursorPoint X and Y
  2030 // this moves the camera according to CursorPoint X and Y
  2032 prevPoint:= CursorPoint;
  2031 prevPoint:= CursorPoint;
  2033 //if cHasFocus then SDL_WarpMouse(CursorPoint.X + (cScreenWidth shr 1), cScreenHeight - CursorPoint.Y);
       
  2034 if WorldDy > LAND_HEIGHT + 1024 then
  2032 if WorldDy > LAND_HEIGHT + 1024 then
  2035     WorldDy:= LAND_HEIGHT + 1024;
  2033     WorldDy:= LAND_HEIGHT + 1024;
  2036 if WorldDy < wdy then
  2034 if WorldDy < wdy then
  2037     WorldDy:= wdy;
  2035     WorldDy:= wdy;
  2038 if WorldDx < - LAND_WIDTH - 1024 then
  2036 if WorldDx < - LAND_WIDTH - 1024 then
  2146     end;
  2144     end;
  2147 end;
  2145 end;
  2148 
  2146 
  2149 procedure updateCursorVisibility;
  2147 procedure updateCursorVisibility;
  2150 begin
  2148 begin
  2151     if isPaused or isAFK then
  2149     if isPaused or isAFK or (GameState = gsConfirm) then
  2152         SDL_ShowCursor(1)
  2150         begin
       
  2151         SDL_SetRelativeMouseMode(SDL_FALSE);
       
  2152         if SDL_ShowCursor(SDL_QUERY) = SDL_DISABLE then
       
  2153             begin
       
  2154             uCursor.resetPosition;
       
  2155             SDL_ShowCursor(SDL_ENABLE);
       
  2156             end;
       
  2157         end
  2153     else
  2158     else
  2154         SDL_ShowCursor(ord(GameState = gsConfirm))
  2159         begin
       
  2160         uCursor.resetPositionDelta;
       
  2161         SDL_ShowCursor(SDL_DISABLE);
       
  2162         SDL_SetRelativeMouseMode(SDL_TRUE);
       
  2163         end;
  2155 end;
  2164 end;
  2156 
  2165 
  2157 procedure updateTouchWidgets(ammoType: TAmmoType);
  2166 procedure updateTouchWidgets(ammoType: TAmmoType);
  2158 begin
  2167 begin
  2159 {$IFDEF USE_TOUCH_INTERFACE}
  2168 {$IFDEF USE_TOUCH_INTERFACE}