Successfully set up virtual machines to run in real time

This commit is contained in:
2021-12-28 15:15:50 -08:00
parent 314eaa024c
commit 6e0b775a86
4 changed files with 228 additions and 10 deletions

View File

@@ -1,9 +1,16 @@
use std::env;
use slipwave::time::{State, Loop};
use slipwave::log::{Logger};
use slipwave::vcr::{ComputeObject};
fn main() {
println!("Slipwave Engine | 2021 | Skye Terran");
// Create a logger
let log_time = Logger::new("time");
// create a sim loop
log_time.print("Creating sim loop...");
let mut sim = Loop::new();
// set the loop update interval
@@ -15,18 +22,24 @@ fn main() {
// datastream
let mut x: i32 = 0;
// Create a compute object
let args: Vec<String> = env::args().collect();
let file_path: &String = &args[1];
// execute the sim loop
log_time.print("Executing loop...");
loop {
// step the sim forward
sim.step();
// update logic goes here
if sim.is_awake() {
//x += 1;
//println!("x: {}", x);
// Create and execute a compute object
let mut vm = ComputeObject::from_file(file_path);
println!("{:?}", vm.execute());
}
sim.get_state().debug_time();
//sim.get_state().debug_time();
// display logic goes here
// problem: the timestep is not what we want here. we need to get the elapsed time