From bbe5ab08684e3b751277b1a34ea64493c78f62e6 Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Mon, 7 Oct 2024 12:08:30 +0200 Subject: [PATCH] draw out of bounds as a darker colour --- src/marble_engine/board.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/marble_engine/board.rs b/src/marble_engine/board.rs index 57f4769..83fb035 100644 --- a/src/marble_engine/board.rs +++ b/src/marble_engine/board.rs @@ -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)); } } }