本文主要是介绍SpriteKit游戏开发点滴(3) 屏幕大小模式,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
SpriteKit的屏幕大小模式有如下四种:
@availability(iOS, introduced=7.0)
enum SKSceneScaleMode : Int {case Fill /* Scale the SKScene to fill the entire SKView. */case AspectFill /* Scale the SKScene to fill the SKView while preserving the scene's aspect ratio. Some cropping may occur if the view has a different aspect ratio. */case AspectFit /* Scale the SKScene to fit within the SKView while preserving the scene's aspect ratio. Some letterboxing may occur if the view has a different aspect ratio. */case ResizeFill /* Modify the SKScene's actual size to exactly match the SKView. */
}
下面逐一进行解释,为了方便解释,我们不妨将原始屏幕的大小设置为1536*1536(正方形),并设置同样大小的背景图片居中显示,然后观察其显示效果:
原始图片的效果:
这篇关于SpriteKit游戏开发点滴(3) 屏幕大小模式的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!