diff options
author | Nao Pross <naopross@thearcway.org> | 2018-12-12 18:13:11 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-12-12 18:13:11 +0100 |
commit | 3efa351a0a92e1c9c26d341adc2d0d64783ffa16 (patch) | |
tree | 628b487cb678e25edef98a1d9169762aa8ae72d8 | |
parent | Add loaded member to sprites and minor corrections (diff) | |
download | Subconscious-java-3efa351a0a92e1c9c26d341adc2d0d64783ffa16.tar.gz Subconscious-java-3efa351a0a92e1c9c26d341adc2d0d64783ffa16.zip |
Fix Map.getSize() to return a Dimension
Diffstat (limited to '')
-rw-r--r-- | src/subconscious/Map.java | 5 | ||||
-rw-r--r-- | src/subconscious/Tile.java | 4 | ||||
-rw-r--r-- | src/subconscious/graphics/MapScene.java | 4 |
3 files changed, 6 insertions, 7 deletions
diff --git a/src/subconscious/Map.java b/src/subconscious/Map.java index 5f15a52..ef6fddb 100644 --- a/src/subconscious/Map.java +++ b/src/subconscious/Map.java @@ -133,9 +133,8 @@ public class Map { return getTile(pos.x, pos.y); } - // TODO fix this garbage - public int getSize() { - return this.size.width; + public Dimension getSize() { + return this.size; } public ArrayList<Actor> getActors() { diff --git a/src/subconscious/Tile.java b/src/subconscious/Tile.java index 1bccdb2..7323d38 100644 --- a/src/subconscious/Tile.java +++ b/src/subconscious/Tile.java @@ -37,7 +37,7 @@ public class Tile { out.add(map.getTile(this.getX()-1, this.getY())); } - if (this.getX() < map.getSize()-1) { + if (this.getX() < map.getSize().width -1) { out.add(map.getTile(this.getX()+1, this.getY())); } @@ -45,7 +45,7 @@ public class Tile { out.add(map.getTile(this.getX(), this.getY()-1)); } - if (this.getY() < map.getSize()-1) { + if (this.getY() < map.getSize().width -1) { out.add(map.getTile(this.getX(), this.getY()+1)); } diff --git a/src/subconscious/graphics/MapScene.java b/src/subconscious/graphics/MapScene.java index feb041a..c7f4167 100644 --- a/src/subconscious/graphics/MapScene.java +++ b/src/subconscious/graphics/MapScene.java @@ -76,7 +76,7 @@ public abstract class MapScene extends Scene { * if there is not tile under screenPos the return value is null */ protected Point tileAtCoordinates(Point screenPos) { - Rectangle mapRect = new Rectangle(0, 0, this.map.getSize(), this.map.getSize()); + Rectangle mapRect = new Rectangle(0, 0, this.map.getSize().width, this.map.getSize().height); if (undoZoomTx == null || undoPanTx == null) { return null; @@ -159,7 +159,7 @@ public abstract class MapScene extends Scene { // draw a border around the map g.setColor(Palette.ORANGE); - int maxBound = this.map.getSize() * tileSize; + int maxBound = this.map.getSize().width * tileSize; g.drawRect(0, 0, maxBound, maxBound); } |