MCPcopy Create free account
hub / github.com/Prograda/Skybolt / runMainLoop

Function runMainLoop

src/Skybolt/SkyboltEngine/UpdateLoop/UpdateLoopUtility.cpp:16–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14using namespace sim;
15
16void runMainLoop(vis::VisRoot& visRoot, EngineRoot& engineRoot, UpdateLoop::ShouldExit shouldExit, SimPausedPredicate paused)
17{
18 // Run main loop
19 auto systemRegistry = engineRoot.systemRegistry;
20 auto simStepper = std::make_shared<SimStepper>(systemRegistry);
21
22 SecondsD minFrameDuration = 0.01;
23 SecondsD currentWallTime = 0;
24
25 UpdateLoop loop(minFrameDuration);
26 loop.exec([&](float dtWallClock) {
27 SecondsD dtSim = paused() ? 0.0 : dtWallClock;
28 simStepper->update(dtSim);
29
30 for (const auto& system : *systemRegistry)
31 {
32 system->advanceWallTime(currentWallTime, dtWallClock);
33 }
34 currentWallTime += dtWallClock;
35
36 return visRoot.render();
37 }, shouldExit);
38}
39
40} // namespace skybolt

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 4

execMethod · 0.80
updateMethod · 0.45
advanceWallTimeMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected