2021-08-12 11:52:21 -06:00
|
|
|
use hypoloop::core::{State, Loop};
|
2021-08-11 14:21:12 -06:00
|
|
|
|
2021-08-11 20:20:26 -06:00
|
|
|
// look into using closures for this
|
2021-08-11 13:52:44 -06:00
|
|
|
fn main() {
|
2021-08-11 20:20:26 -06:00
|
|
|
// create sim and configure it
|
2021-08-12 00:34:13 -06:00
|
|
|
let mut sim = Loop::new();
|
2021-08-11 14:21:12 -06:00
|
|
|
|
2021-08-12 00:34:13 -06:00
|
|
|
// test variable
|
|
|
|
let mut x: f32 = 0.0;
|
2021-08-11 20:20:26 -06:00
|
|
|
|
2021-08-12 11:52:21 -06:00
|
|
|
let update_logic = |state: &mut State| {
|
|
|
|
x += state.get_timescale();
|
|
|
|
print!("x: {} | ", x);
|
|
|
|
|
2021-08-12 00:34:13 -06:00
|
|
|
state.debug_tick();
|
2021-08-12 11:52:21 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
let display_logic = |state: &State| {
|
|
|
|
// put all display logic here
|
|
|
|
};
|
2021-08-12 00:34:13 -06:00
|
|
|
|
2021-08-12 11:52:21 -06:00
|
|
|
// run the simulation using custom update and display logic
|
|
|
|
sim.run(update_logic, display_logic);
|
2021-08-11 20:20:26 -06:00
|
|
|
}
|