MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / RunFrame

Method RunFrame

src/openrct2/Context.cpp:1243–1276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1241#endif // __EMSCRIPTEN__
1242
1243 void RunFrame()
1244 {
1245 PROFILED_FUNCTION();
1246
1247 const auto deltaTime = _timer.GetElapsedTimeAndRestart().count();
1248
1249 // Make sure we catch the state change and reset it.
1250 bool useVariableFrame = ShouldRunVariableFrame();
1251 if (_variableFrame != useVariableFrame)
1252 {
1253 _variableFrame = useVariableFrame;
1254
1255 // Switching from variable to fixed frame requires reseting
1256 // of entity positions back to end of tick positions
1257 auto& tweener = EntityTweener::Get();
1258 tweener.Restore();
1259 tweener.Reset();
1260 }
1261
1262 UpdateTimeAccumulators(deltaTime);
1263
1264 Network::Update();
1265
1266 if (useVariableFrame)
1267 {
1268 RunVariableFrame(deltaTime);
1269 }
1270 else
1271 {
1272 RunFixedFrame(deltaTime);
1273 }
1274
1275 Network::Flush();
1276 }
1277
1278 void UpdateTimeAccumulators(float deltaTime)
1279 {

Callers 1

LaunchMethod · 0.80

Calls 6

FlushFunction · 0.85
countMethod · 0.80
UpdateFunction · 0.50
RestoreMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected