View Int64Utils.hx
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 haxe.Int64; | |
class Int64Utils | |
{ | |
private inline static var MAX_32_PRECISION = 4294967296; | |
public static function fromFloat(f:Float):Int64 { | |
return Int64.make(Std.int(f/MAX_32_PRECISION), Std.int(f-(f/MAX_32_PRECISION))); | |
} |
View FPSCounter.hx
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
class FPSCounter extends TextField | |
{ | |
public var currentFPS (default, null):Float; | |
private var cacheCount:Int; | |
private var times:Array <Float>; | |
private var lastUIUpdate:Float; | |
public function new(x:Float = 10, y:Float = 10, color:Int = 0x000000, fontSize:Int=24) { |
View gist:9539270
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 bitmapData = Assets.getBitmapData(bitmapPath); | |
_fullWidth = bitmapData.width; | |
_fullHeight = bitmapData.height; | |
_chunkSize = chunkSize; | |
_lastChunkRect = new Rectangle(); | |
_currentChunkRect = new Rectangle(); | |
// it's different! remove the old cached chunk data | |
FileUtils.rmdir(_cachePath); |
View gist:9419622
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
class Main extends Sprite | |
{ | |
private var doneFrame:Bool; | |
public function new() | |
{ | |
super(); | |
doneFrame = false; | |
graphics.beginFill(0xff5555); |
View gist:9243014
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
public function dumpSpriteStack(sprite:Sprite) | |
{ | |
trace(spriteToString(sprite)); | |
var parent:Sprite = cast sprite.parent; | |
var c = 1; | |
while (parent != null) | |
{ | |
var indent = '.'; | |
for (i in 0...c) |
View gist:8815829
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
find . -name "*.png" -mtime -1 | du | awk '{total+=$1} END{print total}' |
View gist:8813653
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
public function compareTypes(a:Dynamic, b:Dynamic) | |
{ | |
return (Type.getClass(a) != null) ? (Type.getClass(a) == Type.getClass(b)) : (Type.typeof(a) == Type.typeof(b)); | |
} |
View gist:6108911
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
@:publicFields class Struct | |
{ | |
public function new() {} | |
} | |
class MyStruct extends Struct | |
{ | |
var field1:String; | |
var field2:String; | |
var field3:Bool; |
View gist:6091295
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 haxe.ds.ObjectMap; | |
/* | |
Simple prioritized queue. Throw objects at it and you'll always get back things according | |
to a priority you set. Priorities are retained internally, so you don't need to modify your | |
objects. | |
Usage: | |
// create a queue: |
View gist:6084333
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
// Since you can't do: | |
// class MyMap<String, String> extends Map<String, String> | |
// Try... | |
import haxe.ds.ObjectMap; | |
class ObjectMyMap extends ObjectMap<String, String> | |
{ |
NewerOlder