diff options
author | Matth?us G. Chajdas <dev@anteru.net> | 2019-11-10 13:56:53 +0100 |
---|---|---|
committer | Matth?us G. Chajdas <dev@anteru.net> | 2019-11-10 13:56:53 +0100 |
commit | 1dd3124a9770e11b6684e5dd1e6bc15a0aa3bc67 (patch) | |
tree | 87a171383266dd1f64196589af081bc2f8e497c3 /tests/examplefiles/test.swift | |
parent | f1c080e184dc1bbc36eaa7cd729ff3a499de568a (diff) | |
download | pygments-master.tar.gz |
Diffstat (limited to 'tests/examplefiles/test.swift')
-rw-r--r-- | tests/examplefiles/test.swift | 65 |
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. - } - -} |