Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

adjust screen scale for some ios devices #265

Merged
merged 1 commit into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Runtime/Plugins/platform/ios/DeviceScreen.mm
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#import <UIKit/UIKit.h>
#import "UIWidgetsDevice.h"
extern "C"
{
int IOSDeviceScaleFactor()
float IOSDeviceScaleFactor()
{
return [[UIScreen mainScreen] scale];
float scale = [[UIScreen mainScreen] scale] * 1.0;
if ([UIWidgetsDevice NeedScreenDownSample]) {
scale *= 0.8696;
}
return scale;
}
}
2 changes: 1 addition & 1 deletion Runtime/engine/DisplayMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static float AndroidDevicePixelRatio() {

#if UNITY_IOS
[DllImport("__Internal")]
static extern int IOSDeviceScaleFactor();
static extern float IOSDeviceScaleFactor();

[DllImport("__Internal")]
static extern viewMetrics IOSGetViewportPadding();
Expand Down