draw out of bounds as a darker colour

This commit is contained in:
Crispy 2024-10-07 12:08:30 +02:00
parent e43a422708
commit bbe5ab0868

View file

@ -224,6 +224,8 @@ impl Board {
for y in start_y..(start_y + tile_height) {
let tx = (x as isize + self.offset_x) as usize;
let ty = (y as isize + self.offset_y) as usize;
let px = x * tile_size + offset.x as i32;
let py = y * tile_size + offset.y as i32;
if self.in_bounds((tx, ty).into()) {
let tile = self.rows[ty][tx];
let texname = tile.texture();
@ -231,9 +233,9 @@ impl Board {
continue;
}
let texture = textures.get(&texname);
let px = x * tile_size + offset.x as i32;
let py = y * tile_size + offset.y as i32;
draw_scaled_texture(d, texture, px, py, (1 << zoom) as f32);
} else {
d.draw_rectangle(px, py, tile_size, tile_size, Color::new(0, 0, 0, 80));
}
}
}