Game Development Reference
In-Depth Information
import SpriteKit
class GameViewController: UIViewController {
var scene: GameScene!
override func prefersStatusBarHidden() -> Bool {
return true
}
override func viewDidLoad() {
super.viewDidLoad()
// 1. Configure the main view
let skView = view as SKView
skView.showsFPS = true
// 2. Create and configure our game scene
scene = GameScene(size: skView.bounds.size)
scene.scaleMode = .AspectFill
// 3. Show the scene.
skView.presentScene(scene)
}
}
Save all your changes and click the Play button once more. Wow, um. That was not very
exciting. If you made all the changes, you should now be staring at a totally black screen
with only the current frame rate displayed. This was the intent. You truly are starting from
nothing.
Let's take a moment and examine each component of your new game. First, open
Main.storyboard . Everything here should look pretty normal. You should see a
single storyboard with a single UIViewController . Expand Game View Controller
Scene in the Story Board Explorer and select Game View Controller, as shown in Figure
1-5 .
Figure 1-5 . Game View Controller Scene
Search WWH ::




Custom Search