业精于勤,荒于嬉
全部博文(763)
分类: C/C++
2011-08-25 09:41:45
if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
{
// The device is an iPad running iPhone 3.2 or later.
}
else
{
NSArray *modes = [UIScreen mainScreen].availableModes;
UIScreenMode *mode = [modes objectAtIndex:0];
if( mode.size.width == 640 )
{
// The device is an iPhone 4
[director setContentScaleFactor:2];
}
else
{
// The device is an old school iPhone or iPod touch.
}
}
//-----------------------------------------------------------
#define isRetina ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO) gDisplayRatio = 1.0; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ gCurrentDisplayMode = DISP_IPAD; gDisplayRatio = 2.0; } else { if (isRetina == YES) { [director setContentScaleFactor:2.0]; gCurrentDisplayMode = DISP_RETINA; }else { gCurrentDisplayMode = DISP_WXVGA; } }