Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change SCREEN_REFRESH_RATE_FALLBACK to -1.0 #57938

Merged

Conversation

jordi-star
Copy link
Contributor

If DisplayServer.screen_get_refresh_rate fails, return -1.0 instead of 60.0 to allow for better error handling.

Relates to godotengine/godot-proposals#1284 (comment)

@jordi-star jordi-star requested a review from a team as a code owner February 10, 2022 20:46
@jordi-star jordi-star changed the title Change SCREEN_GET_REFRESH_RATE_FALLBACK to -1.0 Change SCREEN_REFRESH_RATE_FALLBACK to -1.0 Feb 10, 2022
@Calinou Calinou added this to the 4.0 milestone Feb 10, 2022
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The XML parser chokes on this, should be &lt;.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, thanks

[codeblock]
var refresh_rate = DisplayServer.screen_get_refresh_rate()
if refresh_rate &lt; 0:
refresh_rate = 60.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use 4 spaces for indentation in the codeblock (while keeping the tab based indentation of the <description> block).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

@akien-mga akien-mga merged commit 006ce4d into godotengine:master Feb 11, 2022
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants