summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-12-22 03:35:21 +0100
committerNao Pross <naopross@thearcway.org>2018-12-22 03:35:21 +0100
commitcd53bb05a0121973dfb68ce1b255aebb75bd501a (patch)
tree84a5edcd490586a66da9d128ef48d0f612e3c7b9
parentEncapsulate graphics functions to share a state with loaded resources (diff)
downloadSubconscious-rs-cd53bb05a0121973dfb68ce1b255aebb75bd501a.tar.gz
Subconscious-rs-cd53bb05a0121973dfb68ce1b255aebb75bd501a.zip
Skip rendering for blank tiles (value = 0)
Diffstat (limited to '')
-rw-r--r--src/graphics.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/graphics.rs b/src/graphics.rs
index 8ccdbd3..9af03f4 100644
--- a/src/graphics.rs
+++ b/src/graphics.rs
@@ -87,6 +87,12 @@ impl Graphics {
for layer in &state.map.layers {
let tmx_tile = layer.tiles[y as usize][x as usize];
+
+ // blank tile
+ if tmx_tile <= 0 {
+ continue;
+ }
+
let tmx_tileset = state.map.get_tileset_by_gid(tmx_tile).unwrap();
// load tileset if not loaded yet