diff options
author | Nao Pross <naopross@thearcway.org> | 2018-11-19 10:58:47 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-11-19 10:58:47 +0100 |
commit | a659fc5cfe73938731cc0b431f1c42a2fa0ed02d (patch) | |
tree | e1e5a6f81eb9818de548b6219970a33666fbf19d /src/BattleScene.java | |
parent | Update Scene class (and some derivates) to be abstract (diff) | |
download | Subconscious-java-a659fc5cfe73938731cc0b431f1c42a2fa0ed02d.tar.gz Subconscious-java-a659fc5cfe73938731cc0b431f1c42a2fa0ed02d.zip |
Update GameWindow and remove parent frame dependency on Scene
Diffstat (limited to 'src/BattleScene.java')
-rw-r--r-- | src/BattleScene.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/BattleScene.java b/src/BattleScene.java index 1e4b633..df691ea 100644 --- a/src/BattleScene.java +++ b/src/BattleScene.java @@ -43,8 +43,8 @@ public class BattleScene extends MapScene { private int realX = 0; private int realY = 0; - public BattleScene(JFrame frame) { - super(frame); + public BattleScene() { + super(); // TODO: this should be handled in MapScene MapLoader mapLoader = new MapLoader("../testmap.json"); @@ -91,26 +91,27 @@ public class BattleScene extends MapScene { //draw panels g.setColor(Palette.WHITE_T); - g.fillRect(this.WIDTH-100*this.guiSize, this.HEIGHT-100*this.guiSize, + g.fillRect(this.canvasSize.width-100*this.guiSize, this.canvasSize.height-100*this.guiSize, 100*this.guiSize, 100*this.guiSize); - g.fillRect(0, this.HEIGHT-100*this.guiSize, 150*this.guiSize, 100*this.guiSize); + g.fillRect(0, this.canvasSize.height-100*this.guiSize, 150*this.guiSize, 100*this.guiSize); g.setColor(Palette.BLACK); g.setFont(g.getFont().deriveFont(12.0F*this.guiSize)); Tile tile = null; + try{ tile = this.map.getTile(this.previousX, this.previousY); switch (tile.getType()) { case CLEAR: break; case GRASS: - g.drawString("Grass", this.WIDTH-90*this.guiSize, this.HEIGHT-80*this.guiSize); + g.drawString("Grass", this.canvasSize.width-90*this.guiSize, this.canvasSize.height-80*this.guiSize); break; case WATER: - g.drawString("Water", this.WIDTH-90*this.guiSize, this.HEIGHT-80*this.guiSize); + g.drawString("Water", this.canvasSize.width-90*this.guiSize, this.canvasSize.height-80*this.guiSize); break; case MOUNTAIN: - g.drawString("Mountain", this.WIDTH-90*this.guiSize, this.HEIGHT-80*this.guiSize); + g.drawString("Mountain", this.canvasSize.width-90*this.guiSize, this.canvasSize.height-80*this.guiSize); break; } @@ -118,7 +119,7 @@ public class BattleScene extends MapScene { if (this.actorClicked && this.lastActor != null) { g.setColor(Palette.WHITE_T); g.fillRect(0, 0, 100*this.guiSize, 150*this.guiSize); - g.fillRect(this.WIDTH-100*this.guiSize, 0, 100*this.guiSize, 100*this.guiSize); + g.fillRect(this.canvasSize.width-100*this.guiSize, 0, 100*this.guiSize, 100*this.guiSize); g.setColor(Palette.BLACK); g.drawString(this.lastActor.getName(), 5*this.guiSize, 15*this.guiSize); @@ -135,7 +136,7 @@ public class BattleScene extends MapScene { } else if (this.actorClicked) { g.setColor(Palette.WHITE_T); g.fillRect(0, 0, 100*this.guiSize, 150*this.guiSize); - g.fillRect(this.WIDTH-100*this.guiSize, 0, 100*this.guiSize, 100*this.guiSize); + g.fillRect(this.canvasSize.width-100*this.guiSize, 0, 100*this.guiSize, 100*this.guiSize); g.setColor(Palette.BLACK); g.drawString("None left", 5*this.guiSize, 15*this.guiSize); |