This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*jslint white: true*/ | |
| /*global Phaser*/ | |
| /** | |
| * Defines a glow filter for Web GL. | |
| * @module | |
| */ | |
| Phaser.Filter.Glow = function (game) { | |
| 'use strict'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| class StateMachine<P:StateMachineDelegateProtocol>{ | |
| private unowned let delegate:P | |
| private var _state:P.StateType{ | |
| didSet{ | |
| delegate.didTransitionFrom(oldValue, to:_state) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (UIImage *)compressImage:(UIImage *)image{ | |
| float actualHeight = image.size.height; | |
| float actualWidth = image.size.width; | |
| float maxHeight = 600.0; | |
| float maxWidth = 800.0; | |
| float imgRatio = actualWidth/actualHeight; | |
| float maxRatio = maxWidth/maxHeight; | |
| float compressionQuality = 0.5;//50 percent compression | |
| if (actualHeight > maxHeight || actualWidth > maxWidth) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| /// Execute a function on a background thread and then handle result | |
| /// in main thread. | |
| func doBackgroundTask<Params, Result>( | |
| params: Params, | |
| backgroundTask: (Params) -> Result, | |
| onComplete: (Result) -> ()) | |
| { | |
| dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // CoreGraphics+AspectRatio.swift | |
| // EmptySpriteKitGame | |
| // | |
| // Created by Jamie Kosoy on 11/6/15. | |
| // Copyright © 2015 Arbitrary. All rights reserved. | |
| // | |
| import UIKit | |
| import Foundation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Cell: UITableViewCell { | |
| override func drawRect(rect: CGRect) { | |
| var bubbleSpace = CGRectMake(20.0, self.bounds.origin.y, self.bounds.width - 20, self.bounds.height) | |
| let bubblePath1 = UIBezierPath(roundedRect: bubbleSpace, byRoundingCorners: .TopLeft | .TopRight | .BottomRight, cornerRadii: CGSize(width: 20.0, height: 20.0)) | |
| let bubblePath = UIBezierPath(roundedRect: bubbleSpace, cornerRadius: 20.0) | |
| UIColor.greenColor().setStroke() | |
| UIColor.greenColor().setFill() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
| // requestAnimationFrame polyfill by Erik Möller | |
| // fixes from Paul Irish and Tino Zijdel | |
| (function() { | |
| var lastTime = 0; | |
| var vendors = ['ms', 'moz', 'webkit', 'o']; | |
| for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { |
NewerOlder