mirror of https://github.com/axmolengine/axmol.git
getDPI for Mac Implemented
This commit is contained in:
parent
6a2440d6f1
commit
f48a9fb9f0
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue