Merge pull request #13180 from sridher/mac_dpi_fix

getDPI for Mac Implemented
This commit is contained in:
pandamicro 2015-08-04 10:49:14 +08:00
commit f9249f0e49
1 changed files with 7 additions and 2 deletions

View File

@ -36,8 +36,13 @@ NS_CC_BEGIN
int Device::getDPI()
{
//TODO: return correct DPI
return 160;
NSScreen *screen = [NSScreen mainScreen];
NSDictionary *description = [screen deviceDescription];
NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue];
CGSize displayPhysicalSize = CGDisplayScreenSize(
[[description objectForKey:@"NSScreenNumber"] unsignedIntValue]);
return ((displayPixelSize.width / displayPhysicalSize.width) * 25.4f);
}
void Device::setAccelerometerEnabled(bool isEnabled)