fix marbles not working in negative quadrants
This commit is contained in:
parent
70d7256e9d
commit
4c976ab8e2
3 changed files with 46 additions and 36 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue