From 7b125615f304d5efb2b82a3f97ef482f6dd21ac7 Mon Sep 17 00:00:00 2001 From: Luke Biddell Date: Sun, 18 Apr 2021 12:30:20 +0100 Subject: [PATCH] Make aspect ratio 1:1 by making game dimensions 256x256 --- src/engine/core/MarioRender.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/core/MarioRender.java b/src/engine/core/MarioRender.java index aa2786818..d77c87180 100755 --- a/src/engine/core/MarioRender.java +++ b/src/engine/core/MarioRender.java @@ -26,7 +26,7 @@ public MarioRender(float scale) { this.setEnabled(true); this.scale = scale; - Dimension size = new Dimension((int) (256 * scale), (int) (240 * scale)); + Dimension size = new Dimension((int) (256 * scale), (int) (256 * scale)); setPreferredSize(size); setMinimumSize(size); @@ -41,7 +41,7 @@ public void init() { } public void renderWorld(MarioWorld world, Image image, Graphics g, Graphics og) { - og.fillRect(0, 0, 256, 240); + og.fillRect(0, 0, 256, 256); world.render(og); drawStringDropShadow(og, "Lives: " + world.lives, 0, 0, 7); drawStringDropShadow(og, "Coins: " + world.coins, 11, 0, 7); @@ -56,7 +56,7 @@ public void renderWorld(MarioWorld world, Image image, Graphics g, Graphics og) drawStringDropShadow(og, "Buttons: " + pressedButtons, 0, 2, 1); } if (scale > 1) { - g.drawImage(image, 0, 0, (int) (256 * scale), (int) (240 * scale), null); + g.drawImage(image, 0, 0, (int) (256 * scale), (int) (256 * scale), null); } else { g.drawImage(image, 0, 0, null); }