summaryrefslogtreecommitdiff
path: root/platform/ios/godot_view.mm
diff options
context:
space:
mode:
authorZach Coleman <ztc0611@gmail.com>2022-10-29 23:31:13 -0400
committerZach Coleman <ztc0611@gmail.com>2022-10-31 09:33:39 -0400
commit601c42be66c29cac2a546562217afad99a3df581 (patch)
treea0752f112fab61f884bfb991be9cacbf932450bf /platform/ios/godot_view.mm
parent6a9317c9fc8f943586a8cbe6d0d6be6e356add28 (diff)
Add ProMotion Support to iOS Exports
Diffstat (limited to 'platform/ios/godot_view.mm')
-rw-r--r--platform/ios/godot_view.mm13
1 files changed, 7 insertions, 6 deletions
diff --git a/platform/ios/godot_view.mm b/platform/ios/godot_view.mm
index ff90c05b1d..4537dc2985 100644
--- a/platform/ios/godot_view.mm
+++ b/platform/ios/godot_view.mm
@@ -30,6 +30,7 @@
#import "godot_view.h"
+#include "core/config/project_settings.h"
#include "core/os/keyboard.h"
#include "core/string/ustring.h"
#import "display_layer.h"
@@ -205,16 +206,16 @@ static const float earth_gravity = 9.80665;
if (self.useCADisplayLink) {
self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(drawView)];
- // Approximate frame rate
- // assumes device refreshes at 60 fps
- int displayFPS = (NSInteger)(1.0 / self.renderingInterval);
-
- self.displayLink.preferredFramesPerSecond = displayFPS;
+ if (GLOBAL_GET("display/window/ios/allow_high_refresh_rate")) {
+ self.displayLink.preferredFramesPerSecond = 120;
+ } else {
+ self.displayLink.preferredFramesPerSecond = 60;
+ }
// Setup DisplayLink in main thread
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
} else {
- self.animationTimer = [NSTimer scheduledTimerWithTimeInterval:self.renderingInterval target:self selector:@selector(drawView) userInfo:nil repeats:YES];
+ self.animationTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / 60) target:self selector:@selector(drawView) userInfo:nil repeats:YES];
}
}