Skip to content

Instantly share code, notes, and snippets.

View martinwells's full-sized avatar

Martin Wells martinwells

View GitHub Profile
@martinwells
martinwells / FPSCounter.hx
Last active August 29, 2015 13:57
Low impact FPS counter
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) {
@martinwells
martinwells / Int64Utils.hx
Created April 2, 2014 22:23
Convert an int64 to a float and back
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)));
}