Open zilongshanren opened 9 years ago
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)
#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))
#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)
@minggo I think that there is some misunderstanding here. iPhone 6 Plus has a 401 PPI. https://support.apple.com/kb/SP706?viewlocale=en_US
It seems that getDPI() returns the correct result. https://www.paintcodeapp.com/news/iphone-6-screens-demystified
I believe that @dumganhar can say more, because he recently worked on the similar problem. https://github.com/cocos2d/cocos2d-x/issues/18463
Can you close this issue if @dumganhar and @zilongshanren do not mind?
May be it is fixed somewhere, can i use simulator to test it? I don't have iPhone 6 Plus.
@minggo Honestly, I do not know about Apple emulators. :(
But I meant that if getDPI()
returns 489
, then it is the correct value, because PPI
is not equal to DPI
on some devices.
Explanation here https://www.paintcodeapp.com/news/iphone-6-screens-demystified .
And since @dumganhar promised (in English forum) to add the getPPI()
interface. Then it seems like both (this issue and https://github.com/cocos2d/cocos2d-x/issues/18463) issues will be solved.
But I think that he is more familiar with it than me, so I would like to hear his opinion.
The DPI of iPhone6 Plus is 401, but the
Device::getDPI()
returns 489 which is wrong.And some UI controls rely on the DPI of device, so we should fix this issue.