summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/atlas.bmpbin16522 -> 16522 bytes
-rw-r--r--graphics/src/render.rs35
2 files changed, 34 insertions, 1 deletions
diff --git a/assets/atlas.bmp b/assets/atlas.bmp
index 70dc15b..3ec946b 100644
--- a/assets/atlas.bmp
+++ b/assets/atlas.bmp
Binary files differ
diff --git a/graphics/src/render.rs b/graphics/src/render.rs
index 996aa37..cc9847e 100644
--- a/graphics/src/render.rs
+++ b/graphics/src/render.rs
@@ -1,4 +1,9 @@
-use std::{f32, io::Write, time::Duration};
+use std::{
+ f32,
+ hash::{DefaultHasher, Hash, Hasher},
+ io::Write,
+ time::Duration,
+};
use dungeon::{
Dungeon,
@@ -102,6 +107,12 @@ const ATLAS_INV_CONTAINER: (u16, u16) = (1, 1);
const ATLAS_HEART_ICON: (u16, u16) = (2, 1);
const ATLAS_DAMAGE_ICON: (u16, u16) = (3, 1);
+// Floor ext accent textures
+const ATLAS_FLOOR_EXT1: (u16, u16) = (0, 2);
+const ATLAS_FLOOR_EXT2: (u16, u16) = (1, 2);
+const ATLAS_FLOOR_EXT3: (u16, u16) = (2, 2);
+const ATLAS_FLOOR_EXT4: (u16, u16) = (3, 2);
+
// Misc atlas.bmp textures
//const ATLAS_ERROR: (u16, u16) = (3, 3);
@@ -388,6 +399,28 @@ impl Renderer {
TEXTURE_SIZE,
0.0,
);
+ if idx == ATLAS_FLOOR {
+ // add possible extentions
+ let mut hasher = DefaultHasher::new();
+ pos.hash(&mut hasher);
+ let idx_ext = match hasher.finish() % 20 {
+ 0 => Some(ATLAS_FLOOR_EXT1),
+ 5 => Some(ATLAS_FLOOR_EXT2),
+ 10 => Some(ATLAS_FLOOR_EXT3),
+ 15 => Some(ATLAS_FLOOR_EXT4),
+ _ => None,
+ };
+ if let Some(idx) = idx_ext {
+ rt.draw_atlas(
+ &self.textures.atlas,
+ idx,
+ x * TEXTURE_SIZE,
+ y * TEXTURE_SIZE,
+ TEXTURE_SIZE,
+ 0.0,
+ );
+ }
+ }
}
}