diff options
author | Nao Pross <naopross@thearcway.org> | 2018-02-10 14:41:49 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-02-10 14:41:49 +0100 |
commit | d677dbead66c2c52c2ffc51a64ece0a06114d2ad (patch) | |
tree | 188a7a6fc693dd47de18648577fba3c247361f2c /src/main/java/WorldScene.java | |
parent | Implement barebone game engine (diff) | |
download | Subconscious-old-d677dbead66c2c52c2ffc51a64ece0a06114d2ad.tar.gz Subconscious-old-d677dbead66c2c52c2ffc51a64ece0a06114d2ad.zip |
Switch to gradle, update gitignore
Diffstat (limited to 'src/main/java/WorldScene.java')
-rw-r--r-- | src/main/java/WorldScene.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/WorldScene.java b/src/main/java/WorldScene.java new file mode 100644 index 0000000..6dff04a --- /dev/null +++ b/src/main/java/WorldScene.java @@ -0,0 +1,32 @@ +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; + + +public class WorldScene extends Scene { + + private Actor actors[]; + private Map map; + + private int tileSize; + + public WorldScene(Dimension gridSize, int tileSize) { + this.tileSize = tileSize; + map = new Map(gridSize); + } + + @Override + public void render(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + + for (Tile tile : this.map.grid) { + g2d.setColor(Color.GREEN); + g2d.fillRect( + this.tileSize * tile.x, + this.tileSize * tile.y, + this.tileSize, this.tileSize + ); + } + } +} |