3

I'm creating a universal app but I have issues scaling my scene to display correctly on the iPhone X.

I'm using a single scene size of 1536, 2048 and scaling it down to other devices using aspectFill. My scene is displayed correctly on every device except the iPhone X. Objects in my safe area are cut off on the left and right side.

What can I do to fix this issue?

override func viewDidLoad() {
    super.viewDidLoad()
    let scene = GameScene(size:CGSize(width: 1536, height: 2048))
    let skView = self.view as! SKView
    scene.scaleMode = .aspectFill
    skView.presentScene(scene)
  }

My scene setup is based on this answer iOS Universal Device App with SpriteKit, how to scale nodes for all views?

Lcsmnts
  • 31
  • 1
  • 4
  • It would help if you post the code where are you are configuring your view and scene. – peacetype Jan 26 '18 at 13:59
  • Safe area means nothing is going to render, you need to remove it if you want to render in that area – Knight0fDragon Jan 26 '18 at 15:55
  • And of course you must not render anything of importance outside the safe area. For example if you draw cows on a meadow, the meadow should be extended to the whole screen, while you don't want cows outside the safe area. Not if they are of importance to your game. – gnasher729 Jan 27 '18 at 19:31
  • 1
    Anything important to the game is displayed within the safe area. The iPad shows an extended scene based on the gameScene size while the iPhones use the scale mode to draw the scene but anything important is rendered within the safe area. Maybe this method doesn't work on the iPhone x? – Lcsmnts Jan 27 '18 at 23:21

0 Answers0