diff options
author | Nao Pross <naopross@thearcway.org> | 2018-02-10 13:41:19 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-02-10 13:41:19 +0100 |
commit | 3165434c5aa8081b7c7b0a59c668d6135f882629 (patch) | |
tree | bf07ac9f4e5cec22346836da4aa190aa19549c14 /src/WorldScene.java | |
parent | First commit (diff) | |
download | Subconscious-old-3165434c5aa8081b7c7b0a59c668d6135f882629.tar.gz Subconscious-old-3165434c5aa8081b7c7b0a59c668d6135f882629.zip |
Implement barebone game engine
Diffstat (limited to 'src/WorldScene.java')
-rw-r--r-- | src/WorldScene.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/WorldScene.java b/src/WorldScene.java new file mode 100644 index 0000000..6dff04a --- /dev/null +++ b/src/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 + ); + } + } +} |