mirror of
https://github.com/godotengine/godot
synced 2024-10-15 01:28:21 +00:00
Merge pull request #68044 from ztc0611/ios-promotion
Add ProMotion/High Refresh Rate Support to iOS Exports
This commit is contained in:
commit
2bd9a6fe8d
|
@ -565,6 +565,9 @@
|
||||||
The default screen orientation to use on mobile devices. See [enum DisplayServer.ScreenOrientation] for possible values.
|
The default screen orientation to use on mobile devices. See [enum DisplayServer.ScreenOrientation] for possible values.
|
||||||
[b]Note:[/b] When set to a portrait orientation, this project setting does not flip the project resolution's width and height automatically. Instead, you have to set [member display/window/size/viewport_width] and [member display/window/size/viewport_height] accordingly.
|
[b]Note:[/b] When set to a portrait orientation, this project setting does not flip the project resolution's width and height automatically. Instead, you have to set [member display/window/size/viewport_width] and [member display/window/size/viewport_height] accordingly.
|
||||||
</member>
|
</member>
|
||||||
|
<member name="display/window/ios/allow_high_refresh_rate" type="bool" setter="" getter="" default="true">
|
||||||
|
If [code]true[/code], iOS devices that support high refresh rate/"ProMotion" will be allowed to render at up to 120 frames per second.
|
||||||
|
</member>
|
||||||
<member name="display/window/ios/hide_home_indicator" type="bool" setter="" getter="" default="true">
|
<member name="display/window/ios/hide_home_indicator" type="bool" setter="" getter="" default="true">
|
||||||
If [code]true[/code], the home indicator is hidden automatically. This only affects iOS devices without a physical home button.
|
If [code]true[/code], the home indicator is hidden automatically. This only affects iOS devices without a physical home button.
|
||||||
</member>
|
</member>
|
||||||
|
|
|
@ -1826,6 +1826,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||||
PROPERTY_HINT_RANGE,
|
PROPERTY_HINT_RANGE,
|
||||||
"0,33200,1,or_greater")); // No negative numbers
|
"0,33200,1,or_greater")); // No negative numbers
|
||||||
|
|
||||||
|
GLOBAL_DEF("display/window/ios/allow_high_refresh_rate", true);
|
||||||
GLOBAL_DEF("display/window/ios/hide_home_indicator", true);
|
GLOBAL_DEF("display/window/ios/hide_home_indicator", true);
|
||||||
GLOBAL_DEF("display/window/ios/hide_status_bar", true);
|
GLOBAL_DEF("display/window/ios/hide_status_bar", true);
|
||||||
GLOBAL_DEF("display/window/ios/suppress_ui_gesture", true);
|
GLOBAL_DEF("display/window/ios/suppress_ui_gesture", true);
|
||||||
|
|
|
@ -58,5 +58,6 @@
|
||||||
</array>
|
</array>
|
||||||
$additional_plist_content
|
$additional_plist_content
|
||||||
$plist_launch_screen_name
|
$plist_launch_screen_name
|
||||||
|
<key>CADisableMinimumFrameDurationOnPhone</key><true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#import "godot_view.h"
|
#import "godot_view.h"
|
||||||
|
|
||||||
|
#include "core/config/project_settings.h"
|
||||||
#include "core/os/keyboard.h"
|
#include "core/os/keyboard.h"
|
||||||
#include "core/string/ustring.h"
|
#include "core/string/ustring.h"
|
||||||
#import "display_layer.h"
|
#import "display_layer.h"
|
||||||
|
@ -205,16 +206,16 @@ static const float earth_gravity = 9.80665;
|
||||||
if (self.useCADisplayLink) {
|
if (self.useCADisplayLink) {
|
||||||
self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(drawView)];
|
self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(drawView)];
|
||||||
|
|
||||||
// Approximate frame rate
|
if (GLOBAL_GET("display/window/ios/allow_high_refresh_rate")) {
|
||||||
// assumes device refreshes at 60 fps
|
self.displayLink.preferredFramesPerSecond = 120;
|
||||||
int displayFPS = (NSInteger)(1.0 / self.renderingInterval);
|
} else {
|
||||||
|
self.displayLink.preferredFramesPerSecond = 60;
|
||||||
self.displayLink.preferredFramesPerSecond = displayFPS;
|
}
|
||||||
|
|
||||||
// Setup DisplayLink in main thread
|
// Setup DisplayLink in main thread
|
||||||
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
|
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
|
||||||
} else {
|
} 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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue