Updated Toy, reworked project files for different machines

This commit is contained in:
2023-02-22 23:58:12 +11:00
parent b59bb18ce2
commit 34c3cbbe8e
8 changed files with 183 additions and 29 deletions

View File

@@ -338,7 +338,7 @@ void Box_execEngine() {
//set up time
engine.realTime = clock();
engine.simTime = engine.realTime;
clock_t delta = (double) CLOCKS_PER_SEC / 60.0;
clock_t delta = (double) CLOCKS_PER_SEC / 240.0;
while (engine.running) {
execEvents();
@@ -346,19 +346,13 @@ void Box_execEngine() {
//calc the time passed
engine.realTime = clock();
//if not enough time has passed
if (engine.simTime < engine.realTime) {
//while not enough time has passed
while(engine.simTime < engine.realTime) {
//simulate the world
execStep();
//while not enough time has passed
while(engine.simTime < engine.realTime) {
//simulate the world
execStep();
//calc the time simulation
engine.simTime += delta;
}
}
else {
sleep(0.01); //let the machine sleep, 10ms
//calc the time simulation
engine.simTime += delta;
}
//render the world