Massive update, exposed a ton of functions

This commit is contained in:
2021-08-11 23:34:13 -07:00
parent 1e29ee2476
commit bf6c66e3b9
3 changed files with 172 additions and 136 deletions

View File

@@ -6,4 +6,4 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
hypoloop = {version = "0.1.1", path = "D:/Code/hypoloop"}
hypoloop = {version = "0.1.1", path = "D:/OneDrive/Code/hypoloop"}

View File

@@ -1,16 +1,20 @@
use hypoloop::Simulation;
use hypoloop::core::Loop;
// look into using closures for this
fn main() {
// create sim and configure it
let mut sim = Simulation::new();
sim.set_update_function(test);
let mut sim = Loop::new();
//sim.set_realtime(false);
// run sim
sim.run();
}
// test variable
let mut x: f32 = 0.0;
fn test() {
println!("Test");
// run the simulation using custom update logic
sim.run(|state| {
state.debug_tick();
x += 2.0 * state.get_timescale();
//println!("Delta time: {} | Timescale: {} | Sim time: {} | x: {}", state.get_delta_time(), state.get_timescale(), state.get_sim_time().as_millis(), x);
});
}