Fix camera jumping around in touchscreen mode
authorWuzzy <Wuzzy2@mail.ru>
Thu, 18 Apr 2019 20:02:45 +0200
changeset 14814 c2793ff4e887
parent 14813 9443dc6663ba
child 14815 583d8b96fb30
Fix camera jumping around in touchscreen mode
hedgewars/uCursor.pas
hedgewars/uWorld.pas
--- a/hedgewars/uCursor.pas	Thu Apr 18 19:44:25 2019 +0200
+++ b/hedgewars/uCursor.pas	Thu Apr 18 20:02:45 2019 +0200
@@ -1,3 +1,5 @@
+{$INCLUDE "options.inc"}
+
 unit uCursor;
 
 interface
@@ -17,7 +19,9 @@
 begin
     SDL_ShowCursor(SDL_DISABLE);
     resetPosition();
+{$IFNDEF USE_TOUCH_INTERFACE}
     SDL_SetRelativeMouseMode(SDL_TRUE);
+{$ENDIF}
 end;
 
 procedure resetPosition;
--- a/hedgewars/uWorld.pas	Thu Apr 18 19:44:25 2019 +0200
+++ b/hedgewars/uWorld.pas	Thu Apr 18 20:02:45 2019 +0200
@@ -2148,18 +2148,24 @@
 begin
     if isPaused or isAFK or (GameState = gsConfirm) then
         begin
+{$IFNDEF USE_TOUCH_INTERFACE}
         SDL_SetRelativeMouseMode(SDL_FALSE);
+{$ENDIF}
         if SDL_ShowCursor(SDL_QUERY) = SDL_DISABLE then
             begin
             uCursor.resetPosition;
+{$IFNDEF USE_TOUCH_INTERFACE}
             SDL_ShowCursor(SDL_ENABLE);
+{$ENDIF}
             end;
         end
     else
         begin
         uCursor.resetPositionDelta;
+{$IFNDEF USE_TOUCH_INTERFACE}
         SDL_ShowCursor(SDL_DISABLE);
         SDL_SetRelativeMouseMode(SDL_TRUE);
+{$ENDIF}
         end;
 end;