我想创建 game like this .这是益智游戏。
我的问题是我需要为每个设备设置不同的图像吗?所以现在我们可以看到 Apple 有 5 种不同的移动设备尺寸:
- iPhone 3.5''
- iPhone 4''
- iPhone 4.7''
- iPhone 5.5''
- iPad
所以我的问题是,如果我有适用于 iPad retina 的 Assets ,那么我还需要其他 4 个具有适用于 iPhone 大小的背景和拼图图像的相同 Assets 吗?或者我可以优化它?例如,如果我们创建 3d 游戏,openGL 只渲染需要的帧,我们不需要像我们拥有的设备那样多的场景,只需要一个。
最佳答案
像这样检测设备并设置您的 Assets 。
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
CGSize result = [[UIScreen mainScreen] bounds].size;
if (result.height == 480)
{
// Setup iPhone 4, 4s, iPod Touch Assets
}
else
{
// Setup iPhone 5, 5s, 6 Assets
}
}
else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
//Setup iPad Assets
}
关于ios - SpriteKit 支持不同的屏幕尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27899005/