mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-02 18:07:40 +00:00
main: Adjust how SDL_HINT_MAIN_CALLBACK_RATE works.
Now (only in the generic backend, where it is implemented), this hint is always respected. Previously it would only be used if no windows were created, to help reduce CPU load on things like loopwave. Since it's always used now, the default has changed from 60 (Hz) to 0 (run as fast as possible). Things like loopwave should still likely force this way lower than the previous default (and already do: loopwave explicitly sets it to 5). The hint can now also be set to "waitevent" which will cause SDL_AppIterate to only be called after new events have arrived, for apps that are entirely driven by input and want to consume (almost) no power or CPU time until then. Fixes #11093. Fixes #11387.
This commit is contained in:
parent
cd1bd0ac2e
commit
fa9c3331d5
2 changed files with 38 additions and 17 deletions
|
@ -2391,13 +2391,21 @@ extern "C" {
|
|||
/**
|
||||
* Request SDL_AppIterate() be called at a specific rate.
|
||||
*
|
||||
* This number is in Hz, so "60" means try to iterate 60 times per second.
|
||||
* If this is set to a number, it represents Hz, so "60" means try to
|
||||
* iterate 60 times per second. "0" means to iterate as fast as possible.
|
||||
* Negative values are illegal, but reserved, in case they are useful in
|
||||
* a future revision of SDL.
|
||||
*
|
||||
* There are other strings that have special meaning. If set to "waitevent",
|
||||
* SDL_AppIterate will not be called until new event(s) have arrived (and been
|
||||
* processed by SDL_AppEvent). This can be useful for apps that are completely
|
||||
* idle except in response to input.
|
||||
*
|
||||
* On some platforms, or if you are using SDL_main instead of SDL_AppIterate,
|
||||
* this hint is ignored. When the hint can be used, it is allowed to be
|
||||
* changed at any time.
|
||||
*
|
||||
* This defaults to 60, and specifying NULL for the hint's value will restore
|
||||
* This defaults to 0, and specifying NULL for the hint's value will restore
|
||||
* the default.
|
||||
*
|
||||
* This hint can be set anytime.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue