implement level completion, score storing and a dismissable 'level complete' popup

This commit is contained in:
Crispy 2024-10-06 22:24:37 +02:00
parent 4aa5ed9eec
commit f9b8dba019
7 changed files with 130 additions and 18 deletions

View file

@ -62,7 +62,7 @@ impl Game {
while !rl.window_should_close() {
let mut d = rl.begin_drawing(&thread);
if let Some(editor) = &mut self.open_editor {
editor.input(&d);
editor.update(&d);
editor.draw(&mut d, &self.textures);
match editor.get_exit_state() {
ExitState::Dont => (),
@ -70,6 +70,7 @@ impl Game {
let solution = &mut self.solutions.get_mut(editor.level_id()).unwrap()
[self.selected_solution];
solution.board = editor.source_board().to_string();
solution.score = editor.score();
solution.save();
self.open_editor = None;
}
@ -77,6 +78,7 @@ impl Game {
let solution = &mut self.solutions.get_mut(editor.level_id()).unwrap()
[self.selected_solution];
solution.board = editor.source_board().to_string();
solution.score = editor.score();
solution.save();
}
ExitState::ExitNoSave => self.open_editor = None,