Cocos2d iphone Cocos2D-在iPhone5上自动将发布图像的大小从568h调整到@2x?
你好!!我正在使用Cocos2d运行最基本的Hello World应用程序,实际上没有从Xcode中最基本的Cocos2d模板进行修改 当我启动模拟器时,iPhone5的启动图像会自动加载,但几秒钟后,启动图像会切换到default@2x对于iPhone4,在发布图像的两侧都有两条未使用空间的小条纹 为什么会这样?我如何才能使发布图像在几秒钟后不会自动切换到iPhone4的较小版本Cocos2d iphone Cocos2D-在iPhone5上自动将发布图像的大小从568h调整到@2x?,cocos2d-iphone,Cocos2d Iphone,你好!!我正在使用Cocos2d运行最基本的Hello World应用程序,实际上没有从Xcode中最基本的Cocos2d模板进行修改 当我启动模拟器时,iPhone5的启动图像会自动加载,但几秒钟后,启动图像会切换到default@2x对于iPhone4,在发布图像的两侧都有两条未使用空间的小条纹 为什么会这样?我如何才能使发布图像在几秒钟后不会自动切换到iPhone4的较小版本 感谢IntroLayer.mm中的添加以下代码: CCSprite *background; if
感谢IntroLayer.mm中的添加以下代码:
CCSprite *background;
if( IS_IPAD)
{
if(IS_RETINA)
background = [CCSprite spriteWithFile:@"Default-Portrait@2x~ipad.png"];
else
background = [CCSprite spriteWithFile:@"Default-Portrait~ipad.png"];
}
else
{
if(IS_IPHONE5)
background = [CCSprite spriteWithFile:@"Default-568h@2x.png"];
else
{
if(IS_RETINA)
background = [CCSprite spriteWithFile:@"Default@2x.png"];
else
background = [CCSprite spriteWithFile:@"Default.png"];
}
}
使用的宏:
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_IPHONE5 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0f)
#define IS_RETINA ([[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] && ([UIScreen mainScreen].scale == 2.0))