diff --git a/src/editor.rs b/src/editor.rs index ef162d5..457170b 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -63,6 +63,7 @@ pub struct Editor { selected_blueprint: usize, blueprint_scroll: usize, step_time: u128, + max_step_time:u128, } #[derive(Debug, PartialEq)] @@ -139,6 +140,7 @@ impl Editor { selected_blueprint: usize::MAX, blueprint_scroll: 0, step_time: 0, + max_step_time: 0, } } @@ -163,6 +165,7 @@ impl Editor { } fn start_sim(&mut self) { + self.max_step_time = 0; self.machine.reset(); self.machine.set_board(self.source_board.clone()); } @@ -355,6 +358,7 @@ impl Editor { .checked_div(steps_taken) .unwrap_or_default(); self.step_time = avg_step_time; + self.max_step_time = avg_step_time.max(self.max_step_time); } if rl.is_key_pressed(KeyboardKey::KEY_SPACE) { self.step_pressed() @@ -597,6 +601,7 @@ impl Editor { draw_usize(d, textures, self.machine.step_count(), 420, 4, 9, 2); draw_usize(d, textures, self.step_time as usize, 540, 42, 9, 1); + draw_usize(d, textures, self.max_step_time as usize, 540, 58, 9, 1); d.draw_text("input:", 603, 8, 10, Color::WHITE); if simple_button(d, 600, 20, 35, 15) {