summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a9b2cd3)
raw | patch | inline | side by side (parent: a9b2cd3)
author | Stas'M <x86corez@gmail.com> | |
Mon, 24 Sep 2018 12:59:06 +0000 (15:59 +0300) | ||
committer | Stas'M <x86corez@gmail.com> | |
Mon, 24 Sep 2018 12:59:06 +0000 (15:59 +0300) |
src/game/g_options.pas | patch | blob | history |
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index 60b067ed281de1689a980d541789c94f0d371c23..86761de063a688abc621149e2b2adc531c906755 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
procedure g_Options_SetDefaultVideo;
var
target, closest, display: TSDL_DisplayMode;
+ percentage: Integer;
begin
(* Display 0 = Primary display *)
SDL_GetDesktopDisplayMode(0, @display);
gFullScreen := True; (* rotation not allowed? *)
{$ELSE}
(* Window must be smaller than display *)
- target.w := display.w * 75 div 100;
- target.h := display.h * 75 div 100;
- target.format := 0; (* didn't care *)
- target.refresh_rate := 0; (* didn't care *)
- target.driverdata := nil; (* init *)
- SDL_GetClosestDisplayMode(0, @target, @closest);
+ closest.w := display.w;
+ closest.h := display.h;
+ percentage := 75;
+ while (display.w - closest.w < 48) or (display.h - closest.h < 48) do
+ begin
+ if percentage < 25 then
+ begin
+ closest.w := display.w * 75 div 100;
+ closest.h := display.h * 75 div 100;
+ break;
+ end;
+ target.w := display.w * percentage div 100;
+ target.h := display.h * percentage div 100;
+ target.format := 0; (* didn't care *)
+ target.refresh_rate := 0; (* didn't care *)
+ target.driverdata := nil; (* init *)
+ SDL_GetClosestDisplayMode(0, @target, @closest);
+ Dec(percentage);
+ end;
gScreenWidth := closest.w;
gScreenHeight := closest.h;
//gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)