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

Function EngineSys_SetEngineThrottle

engine/engine/src/script/script_engine.cpp:67–89  ·  view source on GitHub ↗

* Enables engine throttling. * * @note It will automatically wake up on input events * @note It will automatically throttle again after the cooldown period * @note It skips entire update+render loop on the main thread. E.g loading of assets, callbacks from threads (http) * @note On threaded systems, Sound will continue to play any started non-streaming sounds. (e.g. looping background music)

Source from the content-addressed store, hash-verified

65 *
66 */
67static int EngineSys_SetEngineThrottle(lua_State* L)
68{
69 DM_LUA_STACK_CHECK(L, 0);
70
71 bool enable = true;
72 if (lua_isboolean(L, 1))
73 {
74 enable = lua_toboolean(L, 1);
75 }
76 else
77 {
78 return DM_LUA_ERROR("Expected boolean as first argument");
79 }
80
81 float cooldown = 0.0f;
82 if (enable)
83 {
84 cooldown = luaL_checknumber(L, 2);
85 }
86
87 dmEngine::SetEngineThrottle(g_Engine, enable, cooldown);
88 return 0;
89}
90
91
92/*#

Callers

nothing calls this directly

Calls 3

lua_tobooleanFunction · 0.85
luaL_checknumberFunction · 0.85
SetEngineThrottleFunction · 0.85

Tested by

no test coverage detected