diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-02-11 23:02:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-11 23:02:58 +0100 |
commit | 006ce4d83d2588907604b121023fb9f060ca1085 (patch) | |
tree | d75fb8ee2b992b4453a7f77bdacfbd637c0d9ad9 /doc/classes | |
parent | 45360ca118a153e6defa6f7cf256f02c1c8fc75d (diff) | |
parent | 7a9972afc2373fb903ca83363de68c067f721e1d (diff) |
Merge pull request #57938 from jordigcs/negative-refresh-rate-fallback
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/DisplayServer.xml | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index 281c218d0d..d28fd5d817 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -403,8 +403,14 @@ <return type="float" /> <argument index="0" name="screen" type="int" default="-1" /> <description> - Returns the current refresh rate of the specified screen. If [code]screen[/code] is [code]SCREEN_OF_MAIN_WINDOW[/code] (the default value), a screen with the main window will be used. - [b]Note:[/b] Returns [code]60.0[/code] if the DisplayServer fails to find the refresh rate for the specified screen. On HTML5, [method screen_get_refresh_rate] will always return [code]60.0[/code] as there is no way to retrieve the refresh rate on that platform. + Returns the current refresh rate of the specified screen. If [code]screen[/code] is [constant SCREEN_OF_MAIN_WINDOW] (the default value), a screen with the main window will be used. + [b]Note:[/b] Returns [code]-1.0[/code] if the DisplayServer fails to find the refresh rate for the specified screen. On HTML5, [method screen_get_refresh_rate] will always return [code]-1.0[/code] as there is no way to retrieve the refresh rate on that platform. + To fallback to a default refresh rate if the method fails, try: + [codeblock] + var refresh_rate = DisplayServer.screen_get_refresh_rate() + if refresh_rate < 0: + refresh_rate = 60.0 + [/codeblock] </description> </method> <method name="screen_get_scale" qualifiers="const"> |