From a659fc5cfe73938731cc0b431f1c42a2fa0ed02d Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 19 Nov 2018 10:58:47 +0100 Subject: Update GameWindow and remove parent frame dependency on Scene --- src/MapScene.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/MapScene.java') diff --git a/src/MapScene.java b/src/MapScene.java index af86431..7ed8e3b 100644 --- a/src/MapScene.java +++ b/src/MapScene.java @@ -46,15 +46,14 @@ public abstract class MapScene extends Scene implements ActionListener { protected int maxSize; protected AffineTransform tx = new AffineTransform(); - public MapScene(JFrame frame) { - super(frame); - + public MapScene() { + super(); //this.map = new Map(new Dimension(10, 10)); } @Override protected void render() { - if (this.WIDTH < this.HEIGHT) { + if (this.canvasSize.width < this.canvasSize.height) { this.maxSize = WIDTH; } else { this.maxSize = HEIGHT; @@ -68,7 +67,7 @@ public abstract class MapScene extends Scene implements ActionListener { Graphics2D g = (Graphics2D) this.buffer.getDrawGraphics(); //clear g.setColor(Palette.BLACK); - g.fillRect(0, 0, this.WIDTH, this.HEIGHT); + g.fillRect(0, 0, this.canvasSize.width, this.canvasSize.height); //zoom and pan if (this.zooming) { -- cgit v1.2.1