Script Editor Sprite Kit GameScene.sks Width and Scene Height

I use the spritekit script to create my scene (as well as the GameScene.sks file when you create a project in xcode 7 ios9). When adjusting the height and width of the screen, SpriteKit uses only pixel values. My question is this:

If I set the pixel values ​​in the pixels of iphone 6, will the game be too small for ipad and iphone 6+? Why is there no option to set the device screen? What should I do to avoid this?

+4
source share
1 answer

Pixel density

First of all, the size of the scene is determined in Pointsnot Pixels.

See how devices that support iOS 9 work:

  • 1 = 1x1 : iPad 2, iPad mini
  • < > 1 = 22 : iPhone 4s, iPhone 5, iPhone 5, iPhone 5S, iPhone 6, iPhone 6s, IPAD -2, IPAD -3, IPAD -4, IPAD 3, iPad 4, iPad Air, iPad Air 2, iPad Pro, iPod touch 5, iPod touch 6
  • 1 = 3x3 : iPhone 6 Plus, iPhone 6s Plus

, .

iPhone/iPad, iOS 9, .

SpriteKit , scaleMode Scene.

4 :

  • : SKScene, SKView.
  • AspectFill: SKScene SKView . , .
  • AspectFit: SKScene, SKView, . , .
  • ResizeFill: SKScene, SKView.

, AspectFill, .

open GameViewController.swift ( .m, Objective-C), viewDidLoad . , .

/* Set the scale mode to scale to fit the window */
gameScene.scaleMode = .AspectFill
+9

Source: https://habr.com/ru/post/1617807/


All Articles