diff options
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); |