* 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)
| 65 | * |
| 66 | */ |
| 67 | static 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 | /*# |
nothing calls this directly
no test coverage detected