Merge pull request #60 from Ewpratten/timer-fix

fixed timer
This commit is contained in:
Evan Pratten 2021-10-03 17:44:36 -07:00 committed by GitHub
commit 9108f27b3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -86,6 +86,13 @@ impl Action<Scenes, ScreenError, GameContext> for LevelSelectScreen {
.send(Some(ControlFlag::SwitchLevel(level)))
.unwrap();
context
.flag_send
.send(Some(ControlFlag::UpdateLevelStart(
Utc::now(),
)))
.unwrap();
// Enter the game
Ok(ActionFlag::SwitchState(Scenes::InGameScene))
} else if self.is_btm_pressed {

View File

@ -323,7 +323,7 @@ impl ScreenSpaceRender for MainMenuScreen {
for (i, (level, time)) in times.iter() {
let time = Duration::seconds(*time);
raylib.draw_text(
&format!("Lvl {} {}:{}", level + 1, time.num_minutes(), time.num_seconds() % 60),
&format!("Lvl {} {}:{}", level, time.num_minutes(), time.num_seconds() % 60),
screen_size.x as i32 - 200,
100 + (25 * (*i as i32)),
20,
@ -333,6 +333,5 @@ impl ScreenSpaceRender for MainMenuScreen {
}
self.is_quit_pressed = mouse_pressed && hovering_quit;
// for
}
}