fix marbles not working in negative quadrants

This commit is contained in:
Crispy 2024-10-07 17:57:07 +02:00
parent 70d7256e9d
commit 4c976ab8e2
3 changed files with 46 additions and 36 deletions

View file

@ -283,6 +283,22 @@ impl Board {
self.height
}
pub fn get_marbles(&self) -> Vec<Pos> {
let mut out = Vec::new();
for y in 0..self.height {
for x in 0..self.width {
if let Tile::Marble { value: _, dir: _ } = self.rows[y][x] {
out.push(Pos {
x: x as isize - self.offset_x,
y: y as isize - self.offset_y,
});
}
}
}
dbg!(&out);
out
}
pub fn draw(&self, d: &mut RaylibDrawHandle, textures: &Textures, offset: Vector2, zoom: i32) {
let tile_size = 16 << zoom;