Summary
I'm creating an SpriteKit game for different devices and I'm wondering what should be the size of the different assets.
What I have right now
I'm creating the SKScene
in viewDidLoad
:
scene = GameScene(size: view.bounds.size)
scene.scaleMode = .AspectFill
I don't want to use viewWillLayoutSubviews
because it is called twice on start up and also each time the device is rotated. I don't think that initialising the scene here is a good idea.
With this configuration, my view is initialised with a width of 600 points (default storyboard size) and then rescaled to the device width. Using println(scene.size.width)
after the view has been layout it displays a 375 points size in the iPhone 6 and 414 points in the iPhone 6 Plus.
I'm using xcassets to provide the background images and I would like to know which sizes should I use. My current configuration is ready for 320 points resolutions (iPhone 4, iPhone 5)
- 1x: 320 pixels
- 2x: 640 pixels
- 3x: 960 pixels
The problem
The problem is that the image will be rescaled in following devices:
- iPhone 6: 750 pixels - 375 points
- iPhone 6 Plus: 1242 pixels - 414 points
- iPad: 768 pixels - 768 points
- iPad retina: 1536 pixels - 768 points
I would like to know how am I supposed to configure the images and the SKScene size to optimise it for all the devices.
viewDidLayoutSubviews
(Notice the Did instead of Will) Do you think this is a good idea? – Octan