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

@ -17,7 +17,7 @@ pub struct Machine {
}
impl Machine {
pub fn new_empty(input:Vec<u8>,width: usize) -> Self {
pub fn new_empty(input: Vec<u8>, width: usize) -> Self {
Self {
board: Board::new_empty(width, width),
marbles: Vec::new(),
@ -58,6 +58,10 @@ impl Machine {
&self.input
}
pub fn step_count(&self) -> usize {
self.steps
}
pub fn set_input(&mut self, bytes: Vec<u8>) {
self.input_index = self.input_index.min(bytes.len());
self.input = bytes;