display_set_sleep_margin


Description

This function can be used to set the sleep margin value used for the render timing of your game, and requires a millisecond value. The default values are as follows:

Platform Milliseconds
Windows 20
macOS 20
Ubuntu 20
HTML5 20
Android/Amazon Fire 4
iOS 4
Windows UWP 20
Xbox 20
PS4 20
Nintendo Switch 20


Note that even if the timing method is set to use vsync timing, the sleep margin will have some effect over the rendering of the game, and so you should take care when setting this value. For more information on display timing, please see display_set_timing_method().


Syntax:

display_set_sleep_margin(milliseconds);

Argument Description
milliseconds The number of milliseconds for the sleep margin


Returns:

N/A


Example:

if display_get_timing_method() != tm_sleep
{
display_set_timing_method(tm_sleep);
if display_get_sleep_margin() != 20
    {
    display_set_sleep_margin(20);
    }
}

The above code will check the timing method and then if it's not set to tm_sleep it will be set to that and the sleep argin set to 20.