2013-02-17 11:34:55 +08:00
|
|
|
#include "platform/CCDevice.h"
|
|
|
|
#include "CCStdC.h"
|
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
int Device::getDPI()
|
2013-02-17 11:34:55 +08:00
|
|
|
{
|
2013-02-17 17:13:06 +08:00
|
|
|
static int dpi = -1;
|
|
|
|
if (dpi == -1)
|
|
|
|
{
|
|
|
|
HDC hScreenDC = GetDC( NULL );
|
|
|
|
int PixelsX = GetDeviceCaps( hScreenDC, HORZRES );
|
|
|
|
int MMX = GetDeviceCaps( hScreenDC, HORZSIZE );
|
|
|
|
ReleaseDC( NULL, hScreenDC );
|
|
|
|
dpi = 254.0f*PixelsX/MMX/10;
|
|
|
|
}
|
|
|
|
return dpi;
|
2013-02-17 11:34:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_CC_END
|