美文网首页
SpriteKit scene自适应

SpriteKit scene自适应

作者: loyoan | 来源:发表于2017-08-22 01:19 被阅读0次

使用Xcode的Game模版,在GameViewController.swift中改写

if let scene = SKScene(fileNamed: "GameScene") {

// Set the scale mode to scale to fit the window

scene.size = UIScreen.main.bounds.size.applying(CGAffineTransform(scaleX: UIScreen.main.scale, y: UIScreen.main.scale))

//增加此行,即可获得设备真实像素大小的scene

scene.scaleMode = .aspectFill

// Present the scene

view.presentScene(scene)

}

相关文章

网友评论

      本文标题:SpriteKit scene自适应

      本文链接:https://www.haomeiwen.com/subject/unlkdxtx.html