MCPcopy Create free account
hub / github.com/defold/defold / UpdateFrameThrottle

Function UpdateFrameThrottle

engine/engine/src/engine.cpp:1867–1892  ·  view source on GitHub ↗

Return true if the frame should be skipped

Source from the content-addressed store, hash-verified

1865
1866 // Return true if the frame should be skipped
1867 static bool UpdateFrameThrottle(HEngine engine, float dt, bool has_input)
1868 {
1869 if (!g_EngineUpdateEnabled) // override from external call (e.g. HTML5)
1870 {
1871 return true;
1872 }
1873
1874 if (!engine->m_ThrottleEnabled)
1875 {
1876 return false;
1877 }
1878
1879 // We have new input, so reset the cooldown
1880 if (has_input)
1881 {
1882 engine->m_ThrottleCooldown = 0;
1883 return false;
1884 }
1885
1886 // If cooldown max is 0, we want 1 frame of update
1887 bool skip = engine->m_ThrottleCooldown > engine->m_ThrottleCooldownMax;
1888
1889 engine->m_ThrottleCooldown += dt;
1890
1891 return skip;
1892 }
1893
1894 static void StepFrame(HEngine engine, float dt)
1895 {

Callers 1

StepFrameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected