DEADSOFTWARE

gl: apply r_resolution_scale without videomode reset
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Tue, 14 Feb 2023 13:57:06 +0000 (16:57 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Fri, 9 Jun 2023 09:13:32 +0000 (12:13 +0300)
src/game/renders/opengl/r_render.pas

index 791a29fc55731ac3277c4445e29bea4191a41c2d..7ef7d7b95424119026bfd31aee8caf44420976bd 100644 (file)
@@ -1064,11 +1064,20 @@ implementation
   end;
 
   procedure r_Render_Draw;
-    var p1, p2: TPlayer; time: LongWord;
+    var p1, p2: TPlayer; time: LongWord; pw, ph: Integer;
   begin
     if gExit = EXIT_QUIT then
       exit;
 
+    {$IFDEF ENABLE_SYSTEM}
+      (* hack: if r_pixel_scale changed, reset menu and other things *)
+      pw := Round(gWinSizeX / r_pixel_scale);
+      ph := Round(gWinSizeY / r_pixel_scale);
+      if (pw <> gScreenWidth) or (ph <> gScreenHeight) then
+        if assigned(sys_ScreenResize) then
+          sys_ScreenResize(gWinSizeX, gWinSizeY);
+    {$ENDIF}
+
     INC(FPSCounter);
     time := GetTickCount64();
     if time - FPSTime >= 1000 then