Fixed bug 4883 - Add approximation for display DPI on iOS
Aaron Barany There appears to be no way to directly access the display DPI on iOS, so as an approximation the DPI for the iPhone 1 is used as a base value and is multiplied by the screen's scale. This should at least give a ballpark number for the various screen scales. (based on https://stackoverflow.com/questions/25756087/detecting-iphone-6-6-screen-sizes-in-point-values it appears that both 2x and 3x are used) I have updated the patch to use a table of current devices and use a computation as a fallback. I have also updated the fallback computation to be more accurate.
This commit is contained in:
parent
9c591a8538
commit
91b24c357b
2 changed files with 167 additions and 3 deletions
|
@ -27,7 +27,10 @@
|
|||
|
||||
@interface SDL_DisplayData : NSObject
|
||||
|
||||
- (instancetype)init;
|
||||
|
||||
@property (nonatomic, strong) UIScreen *uiscreen;
|
||||
@property (nonatomic) float screenDPI;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -41,6 +44,7 @@ extern SDL_bool UIKit_IsDisplayLandscape(UIScreen *uiscreen);
|
|||
|
||||
extern int UIKit_InitModes(_THIS);
|
||||
extern void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
|
||||
extern int UIKit_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi);
|
||||
extern int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
|
||||
extern void UIKit_QuitModes(_THIS);
|
||||
extern int UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue