From c53659d310c3027a71bfbe31661a3337764d9fb8 Mon Sep 17 00:00:00 2001 From: beeanyew Date: Tue, 11 May 2021 21:12:17 +0200 Subject: [PATCH] Fix scaling/centering for RTG modes --- platforms/amiga/rtg/rtg-output-raylib.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/platforms/amiga/rtg/rtg-output-raylib.c b/platforms/amiga/rtg/rtg-output-raylib.c index 83a2fad..672eab7 100644 --- a/platforms/amiga/rtg/rtg-output-raylib.c +++ b/platforms/amiga/rtg/rtg-output-raylib.c @@ -162,10 +162,6 @@ reinit_raylib:; dstscale.x = dstscale.y = 0; dstscale.width = width; dstscale.height = height; - scale_x = 1.0f; - scale_y = 1.0f; - origin.x = 0.0f; - origin.y = 0.0f; if (dstscale.height * 2 <= GetScreenHeight()) { if (width == 320) { @@ -182,10 +178,23 @@ reinit_raylib:; dstscale.width += width; } } - scale_x = dstscale.width / (float)width; - scale_y = dstscale.height / (float)height; + } else if (dstscale.width > GetScreenWidth() || dstscale.height > GetScreenHeight()) { + if (dstscale.width > GetScreenWidth()) { + dstscale.height = dstscale.height * ((float)GetScreenWidth() / (float)width); + dstscale.width = GetScreenWidth(); + } + if (dstscale.height > GetScreenHeight()) { + dstscale.width = dstscale.width * ((float)GetScreenHeight() / (float)height); + dstscale.height = GetScreenHeight(); + } } + scale_x = dstscale.width / (float)width; + scale_y = dstscale.height / (float)height; + + origin.x = (dstscale.width - GetScreenWidth()) * 0.5; + origin.y = (dstscale.height - GetScreenHeight()) * 0.5; + while (1) { if (rtg_on) { BeginDrawing(); -- 2.39.2