This file contains 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
Pod::Spec.new do |s| | |
s.name = "Sparrow" | |
s.version = "2.1" | |
s.summary = "The Open Source Game Engine for iOS" | |
s.description = | |
<<-DESC | |
Sparrow is a pure Objective-C library for game developers, built from ground up | |
for iOS. If you have already worked with Adobe™ Flash or Starling, you will feel | |
right at home: Sparrow uses the same concepts and naming schemes. |
This file contains 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
- (void)addDistortionTo:(SPDisplayObject *)target | |
{ | |
float scale = Sparrow.contentScaleFactor; | |
NSURL *url = scale == 1.0f ? | |
[NSURL URLWithString:@"http://i.imgur.com/n95LSGb.jpg"] : | |
[NSURL URLWithString:@"http://i.imgur.com/QRXLvws.jpg"]; | |
[SPTexture loadFromURL:url generateMipmaps:NO scale:scale | |
onComplete:^(SPTexture *texture, NSError *outError) | |
{ |
This file contains 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 <QuartzCore/QuartzCore.h> // for CACurrentMediaTime() | |
- (void)runPoolBenchmark | |
{ | |
double startTime, endTime; | |
const int NumObjects = 1000000; | |
typedef SPMatrix SPObject; | |
[SPObject purgePool]; | |
NSMutableArray *array = [NSMutableArray arrayWithCapacity:NumObjects]; |
This file contains 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
package com.gamua.flox.utils | |
{ | |
import flash.utils.describeType; | |
import flash.utils.getQualifiedClassName; | |
/** Creates a deep copy of the object. | |
* Beware: all complex data types will become mere 'Object' instances. Supported are only | |
* primitive data types, arrays and objects. Any properties marked with "NonSerialized" | |
* meta data will be ignored by this method. | |
* |
This file contains 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
private function addDistortionTo(target:DisplayObject):void | |
{ | |
var offset:Number = 0; | |
var scale:Number = Starling.contentScaleFactor; | |
var width:int = target.width; | |
var height:int = target.height; | |
var perlinData:BitmapData = new BitmapData(width * scale, height * scale, false); | |
perlinData.perlinNoise(200*scale, 20*scale, 2, 5, true, true, 0, true); | |
This file contains 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 "SPDisplayObject.h" | |
@interface TexturedPolygon : SPDisplayObject | |
- (id)initWithRadius:(float)radius numEdges:(int)numEdges texture:(SPTexture *)texture; | |
@property (nonatomic, assign) int numEdges; | |
@property (nonatomic, assign) float radius; | |
@property (nonatomic, strong) SPTexture *texture; | |
@property (nonatomic, assign) uint color; |
This file contains 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
#!/bin/bash | |
air_sdk="/path/to/air_sdk" | |
adb="$air_sdk/lib/android/bin/adb" | |
adt="$air_sdk/bin/adt" | |
if [ ${1: -4} == ".ipa" ] | |
then | |
"$adt" -installApp -platform ios -package $1 | |
else |
This file contains 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 "SPDisplayObject.h" | |
@interface Polygon : SPDisplayObject | |
- (id)initWithRadius:(float)radius numEdges:(int)numEdges color:(uint)color; | |
- (id)initWithRadius:(float)radius numEdges:(int)numEdges; | |
@property (nonatomic, assign) int numEdges; | |
@property (nonatomic, assign) float radius; | |
@property (nonatomic, assign) uint color; |
This file contains 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
var tab:String = " "; | |
for each (var tinted:Boolean in [true, false]) | |
{ | |
trace(tinted ? "if (tinted)" : "else"); | |
trace("{"); | |
for each (var mipMap:Boolean in [true, false]) | |
{ | |
trace(tab, mipMap ? "if (mipMap)" : "else"); | |
trace(tab, "{"); | |
for each (var repeat:Boolean in [true, false]) |
This file contains 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
package starling.extensions | |
{ | |
import flash.display3D.Context3D; | |
import flash.geom.Point; | |
import flash.geom.Rectangle; | |
import starling.core.RenderSupport; | |
import starling.core.Starling; | |
import starling.display.DisplayObject; | |
import starling.display.Sprite; |