diff --git a/src/editor.rs b/src/editor.rs index 6565fba..bd6bcbe 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -303,7 +303,7 @@ impl Editor { let stage = &self.level.stages()[i]; if self.popup == EndPopup::None { if stage.output().as_bytes() == self.machine.output() { - if i < self.level.stages().len() { + if i + 1 < self.level.stages().len() { self.stage = Some(i + 1); self.total_steps += self.machine.step_count(); self.reset_machine(); @@ -960,11 +960,22 @@ impl Editor { } } - let output_x = 370; + let y = footer_top as i32 + 5; + if let Some(i) = self.stage { + d.draw_text("stage", 370, y, 20, Color::GREEN); + let shown_stage = if self.sim_state == SimState::Editing { + 0 + } else { + i + 1 + }; + let text = format!("{shown_stage}/{}", self.level.stages().len()); + d.draw_text(&text, 370, y + 20, 20, Color::LIGHTGREEN); + } + + let output_x = 440; let output_cell_width = 43; let output_cells = (d.get_screen_width() - output_x) as usize / output_cell_width as usize; - let y = footer_top as i32 + 5; if simple_button(d, output_x, y + 70, 65, 15) { self.output_as_text = !self.output_as_text }