summaryrefslogtreecommitdiff
path: root/src/engine/geometry.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-07-01 23:58:52 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-07-01 23:58:52 +0200
commit8dd9517ae4b925fba5b825da04254412e039fa0c (patch)
treeac7547592e0f184a73330cbc513d3feb07c802db /src/engine/geometry.rs
parent99378ed484b04c710e0307db93ada65b29d93bae (diff)
Continued filling in bitwise game engine
Diffstat (limited to 'src/engine/geometry.rs')
-rw-r--r--src/engine/geometry.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/engine/geometry.rs b/src/engine/geometry.rs
index 22b56f0..02fe44b 100644
--- a/src/engine/geometry.rs
+++ b/src/engine/geometry.rs
@@ -59,6 +59,16 @@ impl Point {
1 << index
}
}
+
+ pub fn to_either_bitfield(&self, width: u8) -> u64 {
+ if self.x >= width {
+ let index = self.y * width + self.x - width;
+ 1 << index
+ } else {
+ let index = self.y * width + self.x;
+ 1 << index
+ }
+ }
}
use std::cmp::Ord;