mirror of https://github.com/axmolengine/axmol.git
Merge pull request #13180 from sridher/mac_dpi_fix
getDPI for Mac Implemented
This commit is contained in:
commit
f9249f0e49
|
@ -36,8 +36,13 @@ NS_CC_BEGIN
|
||||||
|
|
||||||
int Device::getDPI()
|
int Device::getDPI()
|
||||||
{
|
{
|
||||||
//TODO: return correct DPI
|
NSScreen *screen = [NSScreen mainScreen];
|
||||||
return 160;
|
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)
|
void Device::setAccelerometerEnabled(bool isEnabled)
|
||||||
|
|
Loading…
Reference in New Issue