Created
June 25, 2014 11:40
-
-
Save icodeforlove/abed9fd0b1c43cc14ba3 to your computer and use it in GitHub Desktop.
working version of GameViewController.swift for iOS 7.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// GameViewController.swift | |
// | |
import UIKit | |
import SpriteKit | |
class GameViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let skView = self.view as SKView | |
skView.showsFPS = true | |
skView.showsNodeCount = true | |
/* Sprite Kit applies additional optimizations to improve rendering performance */ | |
skView.ignoresSiblingOrder = true | |
let scene = GameScene(size: skView.bounds.size) | |
/* Set the scale mode to scale to fit the window */ | |
scene.scaleMode = .AspectFill | |
skView.presentScene(scene) | |
} | |
override func shouldAutorotate() -> Bool { | |
return true | |
} | |
override func supportedInterfaceOrientations() -> Int { | |
if UIDevice.currentDevice().userInterfaceIdiom == .Phone { | |
return Int(UIInterfaceOrientationMask.AllButUpsideDown.toRaw()) | |
} else { | |
return Int(UIInterfaceOrientationMask.All.toRaw()) | |
} | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Release any cached data, images, etc that aren't in use. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment