1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-05 19:31:35 +00:00

Add get_screen_refresh_rate() to OS

This method can be used to get the refresh rate of a given screen.
It is supported on Windows, macOS, Linux, Android and iOS (but not
HTML5).
This commit is contained in:
Hugo Locurcio
2022-03-06 00:34:56 +01:00
parent 8975470bc2
commit cec7c908ca
17 changed files with 177 additions and 1 deletions

View File

@@ -311,6 +311,10 @@ float _OS::get_screen_max_scale() const {
return OS::get_singleton()->get_screen_max_scale();
}
float _OS::get_screen_refresh_rate(int p_screen) const {
return OS::get_singleton()->get_screen_refresh_rate();
}
Point2 _OS::get_window_position() const {
return OS::get_singleton()->get_window_position();
}
@@ -1267,6 +1271,7 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_screen_dpi", "screen"), &_OS::get_screen_dpi, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("get_screen_scale", "screen"), &_OS::get_screen_scale, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("get_screen_max_scale"), &_OS::get_screen_max_scale);
ClassDB::bind_method(D_METHOD("get_screen_refresh_rate", "screen"), &_OS::get_screen_refresh_rate, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("get_window_position"), &_OS::get_window_position);
ClassDB::bind_method(D_METHOD("set_window_position", "position"), &_OS::set_window_position);
ClassDB::bind_method(D_METHOD("get_window_size"), &_OS::get_window_size);