-
Notifications
You must be signed in to change notification settings - Fork 872
/
Copy pathGameViewController.swift
40 lines (29 loc) · 1.04 KB
/
GameViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
A `UIViewController` subclass that stores references to game-wide input sources and managers.
*/
import UIKit
import SpriteKit
class GameViewController: UIViewController {
// MARK: Properties
let scene = GameScene(fileNamed: "GameScene")!
// MARK: Methods
override func viewDidLoad() {
super.viewDidLoad()
let skView = view as! SKView
// Set the scale mode to scale to fit the window.
scene.scaleMode = .aspectFit
skView.presentScene(scene)
// SpriteKit applies additional optimizations to improve rendering performance.
skView.ignoresSiblingOrder = true
}
/**
Detects taps. If a tap is detected, the the game
advances by creating a new maze or solving the existing maze.
*/
@IBAction func handleTap(_: AnyObject) {
scene.createOrSolveMaze()
}
}