mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 00:51:16 +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:
parent
8975470bc2
commit
cec7c908ca
17 changed files with 177 additions and 1 deletions
|
|
@ -226,6 +226,14 @@ public class GodotIO {
|
|||
return (int)(metrics.density * 160f);
|
||||
}
|
||||
|
||||
public double getScreenRefreshRate(double fallback) {
|
||||
Display display = activity.getWindowManager().getDefaultDisplay();
|
||||
if (display != null) {
|
||||
return display.getRefreshRate();
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
public int[] getWindowSafeArea() {
|
||||
DisplayMetrics metrics = activity.getResources().getDisplayMetrics();
|
||||
Display display = activity.getWindowManager().getDefaultDisplay();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue