1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// use super::{EngineTime, Time};
// pub struct GameLoop {
// pub time: EngineTime,
// pub start: Box<dyn FnMut(Time)>,
// pub early_update: Box<dyn FnMut(Time)>,
// pub fixed_update: Box<dyn FnMut(Time)>,
// pub update: Box<dyn FnMut(Time)>,
// pub stop: Box<dyn FnMut(Time)>,
// }
// impl Default for GameLoop {
// fn default() -> Self {
// Self {
// time: EngineTime::default(),
// start: Box::new(|_| {}),
// early_update: Box::new(|_| {}),
// fixed_update: Box::new(|_| {}),
// update: Box::new(|_| {}),
// stop: Box::new(|_| {}),
// }
// }
// }
// #[allow(unused)]
// impl GameLoop {
// pub fn run(mut self, should_continue: impl Fn() -> bool) {
// (self.start)(self.time);
// while (should_continue)() {
// self.time.update();
// (self.early_update)(self.time);
// while self.time.should_do_tick_unchecked() {
// self.time.tick();
// (self.fixed_update)(self.time);
// }
// (self.update)(self.time);
// }
// (self.stop)(self.time);
// }
// }