使用通用图像资源(SpriteKit 游戏)时背景不适合屏幕

问题描述 投票:0回答:1

我正在使用 SpriteKit 快速制作游戏场景。我使用 Universal images.xcassets 作为背景图像。我的图像尺寸是 2208x1536(px),放在 iPhone 3x 资源上。

在 iPhone 上看起来不错,但在 iPad 上我的背景不适合屏幕。

在 iPhone 上看起来不错。

enter image description here

但是在 iPad 上背景不适合屏幕?

enter image description here

这是我当前的图像资源。

enter image description here

然后,我尝试使用设备特定图像。xcassets,然后将相同的图像放在 iPad 2x 上

enter image description here

现在,背景已经适合iPad上的屏幕了,但是任何节点协调和字体大小都不正确。

enter image description here

这是我的项目的一些信息。

// scene size & scale mode
scene.size = skView.frame.size
scene.scaleMode = .AspectFill

// background color
self.backgroundColor = SKColor.brownColor()

// add background image
let bg = SKSpriteNode(imageNamed:"bg")
bg.position = CGPoint(x: CGRectGetMidX(self.frame), y: CGRectGetMidY(self.frame))
self.addChild(bg)

还有我的作品分辨率

enter image description here

如何解决这个问题?

ios iphone swift sprite-kit
1个回答
1
投票

这似乎更多是场景的scaleMode问题而不是资产问题。

了解 SKScene 缩放模式

场景缩放模式

编辑: 尝试使用通用资源 @2x - @3x 并使用边界而不是框架 universal assets 使用此参考图像 reference image。这是 iPhone 6+ iphone 6+ 和 ipad Air ipad Air

的结果
© www.soinside.com 2019 - 2024. All rights reserved.