Skip to content

Commit d70868c

Browse files
committed
Add support for 4:3 aspect ratio
1 parent 396f551 commit d70868c

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ some buffer overflows have been fixed.
4444
| Alt+(Keypad) Plus | Increase window size |
4545
| Alt+(Keypad) Minus | Decrease window size |
4646
| Alt+R | Reset window if stretched |
47+
| Alt+A | Toggle 4:3 aspect ratio |
4748

4849
## Build
4950

SDLPORT.PAS

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ implementation
2828
xRes = 320;
2929
yRes = 200;
3030
targetFrames = 70;
31-
aspect: real = xRes / yRes;
31+
aspectRes: real = xRes / yRes;
3232

3333
var windowMultiplier: integer;
3434
window: PSDL_Window;
@@ -41,6 +41,7 @@ implementation
4141

4242
windowResized: boolean;
4343
fullScreen: boolean;
44+
aspect: real;
4445

4546
timer: TSDL_TimerID;
4647
frameCount, lastFrameCount, subFrameCount, lastFrameTick: LongInt;
@@ -92,7 +93,7 @@ end;
9293

9394
procedure ResetWindowSize;
9495
begin
95-
SDL_SetWindowSize(window, xRes * windowMultiplier, yRes * windowMultiplier);
96+
SDL_SetWindowSize(window, xRes * windowMultiplier, Round(yRes * windowMultiplier * aspectRes / aspect));
9697
windowResized := true;
9798
end;
9899

@@ -104,6 +105,7 @@ end;
104105
procedure Init;
105106
begin
106107
windowMultiplier := 2;
108+
aspect := aspectRes;
107109

108110
if SDL_Init( SDL_INIT_VIDEO or SDL_INIT_TIMER ) < 0 then HALT;
109111

@@ -335,6 +337,15 @@ begin
335337
exit
336338
end;
337339
end;
340+
SDL_SCANCODE_A :
341+
begin
342+
if (aspect <> aspectRes) then
343+
aspect := aspectRes
344+
else
345+
aspect := 4 / 3;
346+
ResetWindowSize;
347+
exit;
348+
end;
338349
end;
339350
end;
340351

SJ3.PAS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5704,6 +5704,7 @@ begin
57045704
writeln(' * Alt+(Keypad) Plus : Increase window size');
57055705
writeln(' * Alt+(Keypad) Minus : Decrease window size');
57065706
writeln(' * Alt+R : Reset window if stretched');
5707+
writeln(' * Alt+A : Toggle 4:3 aspect ratio');
57075708
writeln('');
57085709
writeln('-------');
57095710
writeln('');

0 commit comments

Comments
 (0)