1

I have been researching all day for a proper implementation of case for iPhone and a Case Ipad sizes. Some people use helper classes to "scale" "or "fit" SpriteKit scenes into the proper view in GVC. I am looking for direction because it is a little confusing. First you have this option in the GVC:

if (UIDevice.currentDevice().userInterfaceIdiom == .Pad) {

        if let scene = Page(fileNamed:"Cover") {
            // Configure the view.
            let skView = self.view as! SKView
            skView.showsFPS = false
            skView.showsNodeCount = false

            /* Sprite Kit applies additional optimizations to improve rendering performance */
            skView.ignoresSiblingOrder = true

            /* Set the scale mode to scale to fit the window */
            scene.scaleMode = .AspectFill
            scene.currentPage = "Cover"

            skView.presentScene(scene)
        }


    } else {

        if let scene = Page(fileNamed:"CoverPhone") {
            // Configure the view.
            let skView = self.view as! SKView
            // skView.showsFPS = true
            //skView.showsNodeCount = true

            /* Sprite Kit applies additional optimizations to improve rendering performance */
            skView.ignoresSiblingOrder = true

            /* Set the scale mode to scale to fit the window */
            scene.scaleMode = .AspectFill
            scene.currentPage = "Cover"
            skView.presentScene(scene)


        } else if let scene = Page(fileNamed:"Cover") {
            // Configure the view.
            let skView = self.view as! SKView
            skView.showsFPS = true
            skView.showsNodeCount = true

            /* Sprite Kit applies additional optimizations to improve rendering performance */
            skView.ignoresSiblingOrder = true

            /* Set the scale mode to scale to fit the window */
            scene.scaleMode = .AspectFill
            scene.currentPage = "Cover"
            skView.presentScene(scene)
        }


    }




}

This in my understanding (code replicated from CartoonSmart, StoryTeller Bundle v.1.10. So I would make two SkS files on for .phone one .pad and configure the scene as such calling the proper scene from GVC.

Then I see these long if statements: a "small" snippet...

if (platform == "iPad2,4") {
    return "iPad 2 (WiFi)"
}
if (platform == "iPad3,1") {
    return "iPad 3 (WiFi)"
}
if (platform == "iPad3,2") {
    return "iPad 3 (GSM+CDMA)"
}
if (platform == "iPad3,3") {
    return "iPad 3 (GSM)"
}
if (platform == "iPad3,4") {
    return "iPad 4 (WiFi)"
}
if (platform == "iPad3,5") {
    return "iPad 4 (GSM)"   

Gist for device types

where exactly does this go and what exactly is the purpose?

My reasoning for asking, for the iPhone, I am using the 1920 by 1080 because when scaled using aspect fill the images @2x resolution are optimize correctly and look great. Also sets up portability to Apple TV down the line.

If I go with creating two sks files do I need to replicate the subclasses etc for the iPad sks files or is their a way to utilize the iPhone classes without having to replicate .swift files that control the nodes in the scenes. Considering I use a Global/Base Scene to handle navigation and other global properties.

upallnight
  • 89
  • 12

0 Answers0