diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2026-08-13 01:56:09 -0700 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2026-08-13 01:56:09 -0700 |
| commit | feefeecec6c6050635b2c016452dfa1529575987 (patch) | |
| tree | 024cc36c2c75e10b6bfd68f29c1494830bec37df /src/sim/overlay.rs | |
| parent | 7ce9781f86c56f932dabc3bc84b8d21d7be8fecc (diff) | |
big refactor for board
Diffstat (limited to 'src/sim/overlay.rs')
| -rw-r--r-- | src/sim/overlay.rs | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/src/sim/overlay.rs b/src/sim/overlay.rs index e0560b5..c9fdf17 100644 --- a/src/sim/overlay.rs +++ b/src/sim/overlay.rs @@ -1,48 +1,49 @@ -use crate::{Config, Input, sim::board::Board}; +use crate::{Config, Input, sim::world::World}; pub fn create_compute_combined_overlay_offset( - board: &Board, + world: &World, config: &Config, input: &Input, ) -> impl Fn(i32, i32) -> (u8, u8, u8, u8) { + puffin::profile_function!(); // TODO fix this move? - move |x: i32, y: i32| { + move |pixel_x: i32, pixel_y: i32| { // could allow negative offsets too let mut offset: (u8, u8, u8, u8) = (0x00, 0x00, 0x00, 0x00); - // bounds - // left - let xl = -((board.size_x / 2 + 1) as i32); - // right - let xu = (board.size_x / 2 + 1) as i32; - // bottom - let yl = -((board.size_y / 2 + 1) as i32); - // top - let yu = (board.size_y / 2 + 1) as i32; + // // bounds + // // left + // let xl = -((board.get_game_width() / 2 + 1) as i32); + // // right + // let xu = (board.get_game_width() / 2 + 1) as i32; + // // bottom + // let yl = -((board.get_game_height() / 2 + 1) as i32); + // // top + // let yu = (board.get_game_height() / 2 + 1) as i32; - if ((x == xl || x == xu) && (y <= yu && y >= yl)) - || (y == yl || y == yu) && (x <= xu && x >= xl) - { - offset.0 = offset.0.saturating_add(0xFF); - offset.1 = offset.1.saturating_add(0xFF); - offset.2 = offset.2.saturating_add(0xFF); - } + // if ((pixel_x == xl || pixel_x == xu) && (pixel_y <= yu && pixel_y >= yl)) + // || (pixel_y == yl || pixel_y == yu) && (pixel_x <= xu && pixel_x >= xl) + // { + // offset.0 = offset.0.saturating_add(0xFF); + // offset.1 = offset.1.saturating_add(0xFF); + // offset.2 = offset.2.saturating_add(0xFF); + // } - // grid - if x % 30 == 0 || y % 30 == 0 { - offset.0 = offset.0.saturating_add(0x10); - offset.1 = offset.1.saturating_add(0x10); - offset.2 = offset.2.saturating_add(0x10); - } + // // grid + // if pixel_x % 30 == 0 || pixel_y % 30 == 0 { + // offset.0 = offset.0.saturating_add(0x10); + // offset.1 = offset.1.saturating_add(0x10); + // offset.2 = offset.2.saturating_add(0x10); + // } - // brush/selection - if input.last_mouse_pos_on_board.is_some_and(|p| { - ((x - p.0).pow(2) + (y - p.1).pow(2)) < (config.brush_radius as i32).pow(2) - }) { - offset.0 = offset.0.saturating_add(0x82); - offset.1 = offset.1.saturating_add(0xA1); - offset.2 = offset.2.saturating_add(0xAD); - } + // // brush/selection + // if input.last_mouse_pos_on_board.is_some_and(|p| { + // ((pixel_x - p.0).pow(2) + (pixel_y - p.1).pow(2)) < (config.brush_radius as i32).pow(2) + // }) { + // offset.0 = offset.0.saturating_add(0x82); + // offset.1 = offset.1.saturating_add(0xA1); + // offset.2 = offset.2.saturating_add(0xAD); + // } return offset; } |
