在游戏适配的过程中,存在ipad中Retina适配问题,需要添加如下代码
if (getDeviceID()==IPAD_RETINA or getDeviceID()==IPHONE_RETINA) {
pDirector->enableRetinaDisplay(true);
}
int getDeviceID(){
int iphone = 1;
int retina = 1;
// Determine device kind
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
// iPad
iphone = 0;
} else {
// iPhone
iphone=1;
}
// Determine retina display
if ([UIScreen instancesRespondToSelector:@selector(scale)] && UIScreen.mainScreen.scale > 1.0) {
// Retina
retina = 1;
} else {
// Non-retina
retina = 0;
}
if(iphone){
if(retina) return IPHONE_RETINA;
return IPHONE_LOW;
}else {
if(retina) return IPAD_RETINA;
return IPAD_LOW;
}
}