summaryrefslogtreecommitdiff
path: root/tests/examplefiles/test.swift
diff options
context:
space:
mode:
Diffstat (limited to 'tests/examplefiles/test.swift')
-rw-r--r--tests/examplefiles/test.swift65
1 files changed, 0 insertions, 65 deletions
diff --git a/tests/examplefiles/test.swift b/tests/examplefiles/test.swift
deleted file mode 100644
index 8ef19763..00000000
--- a/tests/examplefiles/test.swift
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// test.swift
-// from https://github.com/fullstackio/FlappySwift
-//
-// Created by Nate Murray on 6/2/14.
-// Copyright (c) 2014 Fullstack.io. All rights reserved.
-//
-
-import UIKit
-import SpriteKit
-
-extension SKNode {
- class func unarchiveFromFile(file : NSString) -> SKNode? {
-
- let path = NSBundle.mainBundle().pathForResource(file, ofType: "sks")
-
- var sceneData = NSData.dataWithContentsOfFile(path, options: .DataReadingMappedIfSafe, error: nil)
- var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData)
-
- archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene")
- let scene = archiver.decodeObjectForKey(NSKeyedArchiveRootObjectKey) as GameScene
- archiver.finishDecoding()
- return scene
- }
-}
-
-class GameViewController: UIViewController {
-
- override func viewDidLoad() {
- super.viewDidLoad()
-
- if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene {
- // 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
-
- 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.
- }
-
-}