-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameViewController.swift
More file actions
55 lines (48 loc) · 1.56 KB
/
GameViewController.swift
File metadata and controls
55 lines (48 loc) · 1.56 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// GameViewController.swift
// kwon_Ethan_PongApp
//
// Created by Period Three on 2020-01-13.
// Copyright © 2020 Period Three. All rights reserved.
//
import UIKit
import SpriteKit
import GameplayKit
class GameViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
if let view = self.view as! SKView? {
// Load the SKScene from 'GameScene.sks'
if let scene = SKScene(fileNamed: "GameScene") {
// Set the scale mode to scale to fit the window
scene.scaleMode = .aspectFill
let currentScene = scene as! GameScene
currentScene.viewContoller = self
// Present the scene
view.presentScene(scene)
}
// Ignores the order of the other child nodes
view.ignoresSiblingOrder = true
// Shows the frames per second
view.showsFPS = true
// Shows the node count
view.showsNodeCount = false
}
}
// Does not autorotate the view to fit the phone's rotation
override var shouldAutorotate: Bool {
return false
}
// All orientations except for upside down
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
if UIDevice.current.userInterfaceIdiom == .phone {
return .allButUpsideDown
} else {
return .all
}
}
// Hides the status bar
override var prefersStatusBarHidden: Bool {
return true
}
}