;\n\tpublic var nonEmpty:Bool;\n\t\n\t/**\n\t\tCreates and returns a new SlotList object.\n\n\t\tA user never has to create a SlotList manually. \n\t\tUse the NIL
element to represent an empty list. \n\t\tNIL.prepend(value)
would create a list containing \n\t\tvalue
.\n\n\t\t@param head The first slot in the list.\n\t\t@param tail A list containing all slots except head.\n\t**/\n\tpublic function new(head:TSlot, ?tail:SlotList=null)\n\t{\n\t\tnonEmpty = false;\n\t\t\n\t\tif (head == null && tail == null)\n\t\t{\n\t\t\t#if debug\n\t\t\tif (NIL != null) throw \"Parameters head and tail are null. Use the NIL element instead.\";\n\t\t\t#end\n\n\t\t\t// this is the NIL element as per definition\n\t\t\tnonEmpty = false;\n\t\t}\n\t\telse if (head == null)\n\t\t{\n\t\t\t#if debug\n\t\t\tthrow \"Parameter head cannot be null.\";\n\t\t\t#end\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.head = head;\n\t\t\tthis.tail = (tail == null ? cast NIL : tail);\n\t\t\tnonEmpty = true;\n\t\t}\n\t}\n\t\n\t/**\n\t\tThe number of slots in the list.\n\t**/\n\tpublic var length(get_length, null):Int;\n\tfunction get_length():Int\n\t{\n\t\tif (!nonEmpty) return 0;\n\t\tif (tail == NIL) return 1;\n\t\t\n\t\t// We could cache the length, but it would make methods like filterNot unnecessarily complicated.\n\t\t// Instead we assume that O(n) is okay since the length property is used in rare cases.\n\t\t// We could also cache the length lazy, but that is a waste of another 8b per list node (at least).\n\t\t\n\t\tvar result = 0;\n\t\tvar p = this;\n\t\t\n\t\twhile (p.nonEmpty)\n\t\t{\n\t\t\t++result;\n\t\t\tp = p.tail;\n\t\t}\n\t\t\n\t\treturn result;\n\t}\n\t\n\t/**\n\t\tPrepends a slot to this list.\n\t\t@param\tslot The item to be prepended.\n\t\t@return\tA list consisting of slot followed by all elements of this list.\n\t**/\n\tpublic function prepend(slot:TSlot)\n\t{\n\t\treturn new SlotList(slot, this);\n\t}\n\t\n\t/**\n\t\tAppends a slot to this list.\n\t\tNote: appending is O(n). Where possible, prepend which is O(1).\n\t\tIn some cases, many list items must be cloned to \n\t\tavoid changing existing lists.\n\t\t@param\tslot The item to be appended.\n\t\t@return\tA list consisting of all elements of this list followed by slot.\n\t**/\n\tpublic function append(slot:TSlot)\n\t{\n\t\tif (slot == null) return this;\n\t\tif (!nonEmpty) return new SlotList(slot);\n\t\t\n\t\t// Special case: just one slot currently in the list.\n\t\tif (tail == NIL) \n\t\t{\n\t\t\treturn new SlotList(slot).prepend(head);\n\t\t}\n\t\t\n\t\t// The list already has two or more slots.\n\t\t// We have to build a new list with cloned items because they are immutable.\n\t\tvar wholeClone = new SlotList(head);\n\t\tvar subClone = wholeClone;\n\t\tvar current = tail;\n\t\t\n\t\twhile (current.nonEmpty)\n\t\t{\n\t\t\tsubClone = subClone.tail = new SlotList(current.head);\n\t\t\tcurrent = current.tail;\n\t\t}\n\t\t\n\t\t// Append the new slot last.\n\t\tsubClone.tail = new SlotList(slot);\n\t\treturn wholeClone;\n\t}\t\t\n\t\n\t/**\n\t\tInsert a slot into the list in a position according to its priority.\n\t\tThe higher the priority, the closer the item will be inserted to the \n\t\tlist head.\n\t\t@param slot The item to be inserted.\n\t**/\n\tpublic function insertWithPriority(slot:TSlot)\n\t{\n\t\tif (!nonEmpty) return new SlotList(slot);\n\t\t\n\t\tvar priority:Int = slot.priority;\n\t\t\n\t\t// Special case: new slot has the highest priority.\n\t\tif (priority >= this.head.priority) return prepend(slot);\n\n\t\tvar wholeClone = new SlotList(head);\n\t\tvar subClone = wholeClone;\n\t\tvar current = tail;\n\n\t\t// Find a slot with lower priority and go in front of it.\n\t\twhile (current.nonEmpty)\n\t\t{\n\t\t\tif (priority > current.head.priority)\n\t\t\t{\n\t\t\t\tsubClone.tail = current.prepend(slot);\n\t\t\t\treturn wholeClone;\n\t\t\t}\n\t\t\t\n\t\t\tsubClone = subClone.tail = new SlotList(current.head);\n\t\t\tcurrent = current.tail;\n\t\t}\n\t\t\n\t\t// Slot has lowest priority.\n\t\tsubClone.tail = new SlotList(slot);\n\t\treturn wholeClone;\n\t}\n\t\n\t/**\n\t\tReturns the slots in this list that do not contain the supplied \n\t\tlistener. Note: assumes the listener is not repeated within the list.\n\t\t@param\tlistener The function to remove.\n\t\t@return A list consisting of all elements of this list that do not \n\t\t\t\thave listener.\n\t**/\n\tpublic function filterNot(listener:TListener)\n\t{\n\t\tif (!nonEmpty || listener == null) return this;\n\t\t\n\t\tif (Reflect.compareMethods(head.listener, listener)) return tail;\n\t\t\n\t\t// The first item wasn't a match so the filtered list will contain it.\n\t\tvar wholeClone = new SlotList(head);\n\t\tvar subClone = wholeClone;\n\t\tvar current = tail;\n\t\t\n\t\twhile (current.nonEmpty)\n\t\t{\n\t\t\tif (Reflect.compareMethods(current.head.listener, listener))\n\t\t\t{\n\t\t\t\t// Splice out the current head.\n\t\t\t\tsubClone.tail = current.tail;\n\t\t\t\treturn wholeClone;\n\t\t\t}\n\t\t\t\n\t\t\tsubClone = subClone.tail = new SlotList(current.head);\n\t\t\tcurrent = current.tail;\n\t\t}\n\t\t\n\t\t// The listener was not found so this list is unchanged.\n\t\treturn this;\n\t}\n\t\n\t/**\n\t\tDetermines whether the supplied listener Function is contained \n\t\twithin this list\n\t**/\n\tpublic function contains(listener:TListener):Bool\n\t{\n\t\tif (!nonEmpty) return false;\n\n\t\tvar p = this;\n\t\twhile (p.nonEmpty)\n\t\t{\n\t\t\tif (Reflect.compareMethods(p.head.listener, listener)) return true;\n\t\t\tp = p.tail;\n\t\t}\n\n\t\treturn false;\n\t}\n\t\n\t/**\n\t\tRetrieves the Slot associated with a supplied listener within the SlotList.\n\t\t@param listener The Function being searched for\n\t\t@return The ISlot in this list associated with the listener parameter \n\t\t\t\t through the ISlot.listener property. Returns null if no such \n\t\t\t\t ISlot instance exists or the list is empty. \n\t**/\n\tpublic function find(listener:TListener):TSlot\n\t{\n\t\tif (!nonEmpty) return null;\n\t\t\n\t\tvar p = this;\n\t\twhile (p.nonEmpty)\n\t\t{\n\t\t\tif (Reflect.compareMethods(p.head.listener, listener)) return p.head;\n\t\t\tp = p.tail;\n\t\t}\n\t\t\n\t\treturn null;\n\t}\n}\n","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport js.Boot;\n\n@:keepInit\n@:coreApi class Std {\n\n\tpublic static inline function is( v : Dynamic, t : Dynamic ) : Bool {\n\t\treturn untyped js.Boot.__instanceof(v,t);\n\t}\n\n\tpublic static inline function instance( value : T, c : Class ) : S {\n\t\treturn untyped __instanceof__(value, c) ? cast value : null;\n\t}\n\n\tpublic static function string( s : Dynamic ) : String {\n\t\treturn untyped js.Boot.__string_rec(s,\"\");\n\t}\n\n\tpublic static inline function int( x : Float ) : Int {\n\t\treturn (cast x) | 0;\n\t}\n\n\tpublic static function parseInt( x : String ) : Null {\n\t\tvar v = untyped __js__(\"parseInt\")(x, 10);\n\t\t// parse again if hexadecimal\n\t\tif( v == 0 && (x.charCodeAt(1) == 'x'.code || x.charCodeAt(1) == 'X'.code) )\n\t\t\tv = untyped __js__(\"parseInt\")(x);\n\t\tif( untyped __js__(\"isNaN\")(v) )\n\t\t\treturn null;\n\t\treturn cast v;\n\t}\n\n\tpublic static inline function parseFloat( x : String ) : Float {\n\t\treturn untyped __js__(\"parseFloat\")(x);\n\t}\n\n\tpublic static function random( x : Int ) : Int {\n\t\treturn untyped x <= 0 ? 0 : Math.floor(Math.random()*x);\n\t}\n\n\tstatic function __init__() : Void untyped {\n\t\t__feature__(\"js.Boot.getClass\",String.prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"String\"] = String,String));\n\t\t__feature__(\"js.Boot.isClass\",String.__name__ = __feature__(\"Type.getClassName\",[\"String\"],true));\n\t\t__feature__(\"Type.resolveClass\",$hxClasses[\"Array\"] = Array);\n\t\t__feature__(\"js.Boot.isClass\",Array.__name__ = __feature__(\"Type.getClassName\",[\"Array\"],true));\n\t\t__feature__(\"Date.*\", {\n\t\t\t__feature__(\"js.Boot.getClass\",__js__('Date').prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"Date\"] = __js__('Date'),__js__('Date')));\n\t\t\t__feature__(\"js.Boot.isClass\",__js__('Date').__name__ = [\"Date\"]);\n\t\t});\n\t\t__feature__(\"Int.*\",{\n\t\t\tvar Int = __feature__(\"Type.resolveClass\", $hxClasses[\"Int\"] = { __name__ : [\"Int\"] }, { __name__ : [\"Int\"] });\n\t\t});\n\t\t__feature__(\"Dynamic.*\",{\n\t\t\tvar Dynamic = __feature__(\"Type.resolveClass\", $hxClasses[\"Dynamic\"] = { __name__ : [\"Dynamic\"] }, { __name__ : [\"Dynamic\"] });\n\t\t});\n\t\t__feature__(\"Float.*\",{\n\t\t\tvar Float = __feature__(\"Type.resolveClass\", $hxClasses[\"Float\"] = __js__(\"Number\"), __js__(\"Number\"));\n\t\t\tFloat.__name__ = [\"Float\"];\n\t\t});\n\t\t__feature__(\"Bool.*\",{\n\t\t\tvar Bool = __feature__(\"Type.resolveEnum\",$hxClasses[\"Bool\"] = __js__(\"Boolean\"), __js__(\"Boolean\"));\n\t\t\tBool.__ename__ = [\"Bool\"];\n\t\t});\n\t\t__feature__(\"Class.*\",{\n\t\t\tvar Class = __feature__(\"Type.resolveClass\", $hxClasses[\"Class\"] = { __name__ : [\"Class\"] }, { __name__ : [\"Class\"] });\n\t\t});\n\t\t__feature__(\"Enum.*\",{\n\t\t\tvar Enum = {};\n\t\t});\n\t\t__feature__(\"Void.*\",{\n\t\t\tvar Void = __feature__(\"Type.resolveEnum\", $hxClasses[\"Void\"] = { __ename__ : [\"Void\"] }, { __ename__ : [\"Void\"] });\n\t\t});\n\n#if !js_es5\n\t\t__feature__(\"Array.map\",\n\t\t\tif( Array.prototype.map == null )\n\t\t\t\tArray.prototype.map = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length )\n\t\t\t\t\t\ta[i] = f(__this__[i]);\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n\t\t__feature__(\"Array.filter\",\n\t\t\tif( Array.prototype.filter == null )\n\t\t\t\tArray.prototype.filter = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length ) {\n\t\t\t\t\t\tvar e = __this__[i];\n\t\t\t\t\t\tif( f(e) ) a.push(e);\n\t\t\t\t\t}\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n#end\n\t}\n\n}\n"],
+"sourcesContent":["/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class EReg {\n\n\tvar r : HaxeRegExp;\n\n\tpublic function new( r : String, opt : String ) : Void {\n\t\topt = opt.split(\"u\").join(\"\"); // 'u' (utf8) depends on page encoding\n\t\tthis.r = new HaxeRegExp(r, opt);\n\t}\n\n\tpublic function match( s : String ) : Bool {\n\t\tif( r.global ) r.lastIndex = 0;\n\t\tr.m = r.exec(s);\n\t\tr.s = s;\n\t\treturn (r.m != null);\n\t}\n\n\tpublic function matched( n : Int ) : String {\n\t\treturn if( r.m != null && n >= 0 && n < r.m.length ) r.m[n] else throw \"EReg::matched\";\n\t}\n\n\tpublic function matchedLeft() : String {\n\t\tif( r.m == null ) throw \"No string matched\";\n\t\treturn r.s.substr(0,r.m.index);\n\t}\n\n\tpublic function matchedRight() : String {\n\t\tif( r.m == null ) throw \"No string matched\";\n\t\tvar sz = r.m.index+r.m[0].length;\n\t\treturn r.s.substr(sz,r.s.length-sz);\n\t}\n\n\tpublic function matchedPos() : { pos : Int, len : Int } {\n\t\tif( r.m == null ) throw \"No string matched\";\n\t\treturn { pos : r.m.index, len : r.m[0].length };\n\t}\n\n\tpublic function matchSub( s : String, pos : Int, len : Int = -1):Bool {\n\t\treturn if (r.global) {\n\t\t\tr.lastIndex = pos;\n\t\t\tr.m = r.exec(len < 0 ? s : s.substr(0, pos + len));\n\t\t\tvar b = r.m != null;\n\t\t\tif (b) {\n\t\t\t\tr.s = s;\n\t\t\t}\n\t\t\tb;\n\t\t} else {\n\t\t\t// TODO: check some ^/$ related corner cases\n\t\t\tvar b = match( len < 0 ? s.substr(pos) : s.substr(pos,len) );\n\t\t\tif (b) {\n\t\t\t\tr.s = s;\n\t\t\t\tr.m.index += pos;\n\t\t\t}\n\t\t\tb;\n\t\t}\n\t}\n\n\tpublic function split( s : String ) : Array {\n\t\t// we can't use directly s.split because it's ignoring the 'g' flag\n\t\tvar d = \"#__delim__#\";\n\t\treturn untyped s.replace(r,d).split(d);\n\t}\n\n\tpublic function replace( s : String, by : String ) : String {\n\t\treturn untyped s.replace(r,by);\n\t}\n\n\tpublic function map( s : String, f : EReg -> String ) : String {\n\t\tvar offset = 0;\n\t\tvar buf = new StringBuf();\n\t\tdo {\n\t\t\tif (offset >= s.length)\n\t\t\t\tbreak;\n\t\t\telse if (!matchSub(s, offset)) {\n\t\t\t\tbuf.add(s.substr(offset));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvar p = matchedPos();\n\t\t\tbuf.add(s.substr(offset, p.pos - offset));\n\t\t\tbuf.add(f(this));\n\t\t\tif (p.len == 0) {\n\t\t\t\tbuf.add(s.substr(p.pos, 1));\n\t\t\t\toffset = p.pos + 1;\n\t\t\t}\n\t\t\telse\n\t\t\t\toffset = p.pos + p.len;\n\t\t} while (r.global);\n\t\tif (!r.global && offset > 0 && offset < s.length)\n\t\t\tbuf.add(s.substr(offset));\n\t\treturn buf.toString();\n\t}\n}\n\n@:native(\"RegExp\")\nprivate extern class HaxeRegExp extends js.RegExp {\n\tvar m:js.RegExp.RegExpMatch;\n\tvar s:String;\n}\n","import js.html.Performance;\nimport js.html.DivElement;\nimport js.Browser;\n\n@:expose class Perf {\n\n\tpublic static var MEASUREMENT_INTERVAL:Int = 1000;\n\n\tpublic static var FONT_FAMILY:String = \"Helvetica,Arial\";\n\n\tpublic static var FPS_BG_CLR:String = \"#00FF00\";\n\tpublic static var FPS_WARN_BG_CLR:String = \"#FF8000\";\n\tpublic static var FPS_PROB_BG_CLR:String = \"#FF0000\";\n\n\tpublic static var MS_BG_CLR:String = \"#FFFF00\";\n\tpublic static var MEM_BG_CLR:String = \"#086A87\";\n\tpublic static var INFO_BG_CLR:String = \"#00FFFF\";\n\tpublic static var FPS_TXT_CLR:String = \"#000000\";\n\tpublic static var MS_TXT_CLR:String = \"#000000\";\n\tpublic static var MEM_TXT_CLR:String = \"#FFFFFF\";\n\tpublic static var INFO_TXT_CLR:String = \"#000000\";\n\n\tpublic static var TOP_LEFT:String = \"TL\";\n\tpublic static var TOP_RIGHT:String = \"TR\";\n\tpublic static var BOTTOM_LEFT:String = \"BL\";\n\tpublic static var BOTTOM_RIGHT:String = \"BR\";\n\n\tstatic var DELAY_TIME:Int = 4000;\n\n\tpublic var fps:DivElement;\n\tpublic var ms:DivElement;\n\tpublic var memory:DivElement;\n\tpublic var info:DivElement;\n\n\tpublic var lowFps:Float;\n\tpublic var avgFps:Float;\n\tpublic var currentFps:Float;\n\tpublic var currentMs:Float;\n\tpublic var currentMem:String;\n\n\tvar _time:Float;\n\tvar _startTime:Float;\n\tvar _prevTime:Float;\n\tvar _ticks:Int;\n\tvar _fpsMin:Float;\n\tvar _fpsMax:Float;\n\tvar _memCheck:Bool;\n\tvar _pos:String;\n\tvar _offset:Float;\n\tvar _measureCount:Int;\n\tvar _totalFps:Float;\n\n\tvar _perfObj:Performance;\n\tvar _memoryObj:Memory;\n\tvar _raf:Int;\n\n\tvar RAF:Dynamic;\n\tvar CAF:Dynamic;\n\n\tpublic function new(?pos = \"TR\", ?offset:Float = 0) {\n\t\t_perfObj = Browser.window.performance;\n\t\tif (Reflect.field(_perfObj, \"memory\") != null) _memoryObj = Reflect.field(_perfObj, \"memory\");\n\t\t_memCheck = (_perfObj != null && _memoryObj != null && _memoryObj.totalJSHeapSize > 0);\n\n\t\t_pos = pos;\n\t\t_offset = offset;\n\n\t\t_init();\n\t\t_createFpsDom();\n\t\t_createMsDom();\n\t\tif (_memCheck) _createMemoryDom();\n\n\t\tif (Browser.window.requestAnimationFrame != null) RAF = Browser.window.requestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozRequestAnimationFrame != null) RAF = untyped __js__(\"window\").mozRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitRequestAnimationFrame != null) RAF = untyped __js__(\"window\").webkitRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msRequestAnimationFrame != null) RAF = untyped __js__(\"window\").msRequestAnimationFrame;\n\n\t\tif (Browser.window.cancelAnimationFrame != null) CAF = Browser.window.cancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozCancelAnimationFrame != null) CAF = untyped __js__(\"window\").mozCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitCancelAnimationFrame != null) CAF = untyped __js__(\"window\").webkitCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msCancelAnimationFrame != null) CAF = untyped __js__(\"window\").msCancelAnimationFrame;\n\n\t\tif (RAF != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tinline function _init() {\n\t\tcurrentFps = 60;\n\t\tcurrentMs = 0;\n\t\tcurrentMem = \"0\";\n\n\t\tlowFps = 60;\n\t\tavgFps = 60;\n\n\t\t_measureCount = 0;\n\t\t_totalFps = 0;\n\t\t_time = 0;\n\t\t_ticks = 0;\n\t\t_fpsMin = 60;\n\t\t_fpsMax = 60;\n\t\t_startTime = _now();\n\t\t_prevTime = -MEASUREMENT_INTERVAL;\n\t}\n\n\tinline function _now():Float {\n\t\treturn (_perfObj != null && _perfObj.now != null) ? _perfObj.now() : Date.now().getTime();\n\t}\n\n\tfunction _tick(val:Float) {\n\t\tvar time = _now();\n\t\t_ticks++;\n\n\t\tif (_raf != null && time > _prevTime + MEASUREMENT_INTERVAL) {\n\t\t\tcurrentMs = Math.round(time - _startTime);\n\t\t\tms.innerHTML = \"MS: \" + currentMs;\n\n\t\t\tcurrentFps = Math.round((_ticks * 1000) / (time - _prevTime));\n\t\t\tif (currentFps > 0 && val > DELAY_TIME) {\n\t\t\t\t_measureCount++;\n\t\t\t\t_totalFps += currentFps;\n\t\t\t\tlowFps = _fpsMin = Math.min(_fpsMin, currentFps);\n\t\t\t\t_fpsMax = Math.max(_fpsMax, currentFps);\n\t\t\t\tavgFps = Math.round(_totalFps / _measureCount);\n\t\t\t}\n\n\t\t\tfps.innerHTML = \"FPS: \" + currentFps + \" (\" + _fpsMin + \"-\" + _fpsMax + \")\";\n\n\t\t\tif (currentFps >= 30) fps.style.backgroundColor = FPS_BG_CLR;\n\t\t\telse if (currentFps >= 15) fps.style.backgroundColor = FPS_WARN_BG_CLR;\n\t\t\telse fps.style.backgroundColor = FPS_PROB_BG_CLR;\n\n\t\t\t_prevTime = time;\n\t\t\t_ticks = 0;\n\n\t\t\tif (_memCheck) {\n\t\t\t\tcurrentMem = _getFormattedSize(_memoryObj.usedJSHeapSize, 2);\n\t\t\t\tmemory.innerHTML = \"MEM: \" + currentMem;\n\t\t\t}\n\t\t}\n\t\t_startTime = time;\n\n\t\tif (_raf != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tfunction _createDiv(id:String, ?top:Float = 0):DivElement {\n\t\tvar div:DivElement = Browser.document.createDivElement();\n\t\tdiv.id = id;\n\t\tdiv.className = id;\n\t\tdiv.style.position = \"absolute\";\n\n\t\tswitch (_pos) {\n\t\t\tcase \"TL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"TR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"BL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t\tcase \"BR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t}\n\n\t\tdiv.style.width = \"80px\";\n\t\tdiv.style.height = \"12px\";\n\t\tdiv.style.lineHeight = \"12px\";\n\t\tdiv.style.padding = \"2px\";\n\t\tdiv.style.fontFamily = FONT_FAMILY;\n\t\tdiv.style.fontSize = \"9px\";\n\t\tdiv.style.fontWeight = \"bold\";\n\t\tdiv.style.textAlign = \"center\";\n\t\tBrowser.document.body.appendChild(div);\n\t\treturn div;\n\t}\n\n\tfunction _createFpsDom() {\n\t\tfps = _createDiv(\"fps\");\n\t\tfps.style.backgroundColor = FPS_BG_CLR;\n\t\tfps.style.zIndex = \"995\";\n\t\tfps.style.color = FPS_TXT_CLR;\n\t\tfps.innerHTML = \"FPS: 0\";\n\t}\n\n\tfunction _createMsDom() {\n\t\tms = _createDiv(\"ms\", 16);\n\t\tms.style.backgroundColor = MS_BG_CLR;\n\t\tms.style.zIndex = \"996\";\n\t\tms.style.color = MS_TXT_CLR;\n\t\tms.innerHTML = \"MS: 0\";\n\t}\n\n\tfunction _createMemoryDom() {\n\t\tmemory = _createDiv(\"memory\", 32);\n\t\tmemory.style.backgroundColor = MEM_BG_CLR;\n\t\tmemory.style.color = MEM_TXT_CLR;\n\t\tmemory.style.zIndex = \"997\";\n\t\tmemory.innerHTML = \"MEM: 0\";\n\t}\n\n\tfunction _getFormattedSize(bytes:Float, ?frac:Int = 0):String {\n\t\tvar sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n\t\tif (bytes == 0) return \"0\";\n\t\tvar precision = Math.pow(10, frac);\n\t\tvar i = Math.floor(Math.log(bytes) / Math.log(1024));\n\t\treturn Math.round(bytes * precision / Math.pow(1024, i)) / precision + \" \" + sizes[i];\n\t}\n\n\tpublic function addInfo(val:String) {\n\t\tinfo = _createDiv(\"info\", (_memCheck) ? 48 : 32);\n\t\tinfo.style.backgroundColor = INFO_BG_CLR;\n\t\tinfo.style.color = INFO_TXT_CLR;\n\t\tinfo.style.zIndex = \"998\";\n\t\tinfo.innerHTML = val;\n\t}\n\n\tpublic function clearInfo() {\n\t\tif (info != null) {\n\t\t\tBrowser.document.body.removeChild(info);\n\t\t\tinfo = null;\n\t\t}\n\t}\n\n\tpublic function destroy() {\n\t\t_cancelRAF();\n\t\t_perfObj = null;\n\t\t_memoryObj = null;\n\t\tif (fps != null) {\n\t\t\tBrowser.document.body.removeChild(fps);\n\t\t\tfps = null;\n\t\t}\n\t\tif (ms != null) {\n\t\t\tBrowser.document.body.removeChild(ms);\n\t\t\tms = null;\n\t\t}\n\t\tif (memory != null) {\n\t\t\tBrowser.document.body.removeChild(memory);\n\t\t\tmemory = null;\n\t\t}\n\t\tclearInfo();\n\t\t_init();\n\t}\n\n\tinline function _cancelRAF() {\n\t\tReflect.callMethod(Browser.window, CAF, [_raf]);\n\t\t_raf = null;\n\t}\n}\n\ntypedef Memory = {\n\tvar usedJSHeapSize:Float;\n\tvar totalJSHeapSize:Float;\n\tvar jsHeapSizeLimit:Float;\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class Reflect {\n\n\tpublic inline static function hasField( o : Dynamic, field : String ) : Bool {\n\t\treturn untyped __js__('Object').prototype.hasOwnProperty.call(o, field);\n\t}\n\n\tpublic static function field( o : Dynamic, field : String ) : Dynamic {\n\t\ttry return untyped o[field] catch( e : Dynamic ) return null;\n\t}\n\n\tpublic inline static function setField( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\to[field] = value;\n\t}\n\n\tpublic static inline function getProperty( o : Dynamic, field : String ) : Dynamic untyped {\n\t\tvar tmp;\n\t\treturn if( o == null ) __define_feature__(\"Reflect.getProperty\",null) else if( o.__properties__ && (tmp=o.__properties__[\"get_\"+field]) ) o[tmp]() else o[field];\n\t}\n\n\tpublic static inline function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\tvar tmp;\n\t\tif( o.__properties__ && (tmp=o.__properties__[\"set_\"+field]) ) o[tmp](value) else o[field] = __define_feature__(\"Reflect.setProperty\",value);\n\t}\n\n\tpublic inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array ) : Dynamic untyped {\n\t\treturn func.apply(o,args);\n\t}\n\n\tpublic static function fields( o : Dynamic ) : Array {\n\t\tvar a = [];\n\t\tif (o != null) untyped {\n\t\t\tvar hasOwnProperty = __js__('Object').prototype.hasOwnProperty;\n\t\t\t__js__(\"for( var f in o ) {\");\n\t\t\tif( f != \"__id__\" && f != \"hx__closures__\" && hasOwnProperty.call(o, f) ) a.push(f);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static function isFunction( f : Dynamic ) : Bool untyped {\n\t\treturn __js__(\"typeof(f)\") == \"function\" && !(js.Boot.isClass(f) || js.Boot.isEnum(f));\n\t}\n\n\tpublic static function compare( a : T, b : T ) : Int {\n\t\treturn ( a == b ) ? 0 : (((cast a) > (cast b)) ? 1 : -1);\n\t}\n\n\tpublic static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool {\n\t\tif( f1 == f2 )\n\t\t\treturn true;\n\t\tif( !isFunction(f1) || !isFunction(f2) )\n\t\t\treturn false;\n\t\treturn f1.scope == f2.scope && f1.method == f2.method && f1.method != null;\n\t}\n\n\tpublic static function isObject( v : Dynamic ) : Bool untyped {\n\t\tif( v == null )\n\t\t\treturn false;\n\t\tvar t = __js__(\"typeof(v)\");\n\t\treturn (t == \"string\" || (t == \"object\" && v.__enum__ == null)) || (t == \"function\" && (js.Boot.isClass(v) || js.Boot.isEnum(v)) != null);\n\t}\n\n\tpublic static function isEnumValue( v : Dynamic ) : Bool {\n\t\treturn v != null && v.__enum__ != null;\n\t}\n\n\tpublic static function deleteField( o : Dynamic, field : String ) : Bool untyped {\n\t\tif( !hasField(o,field) ) return false;\n\t\t__js__(\"delete\")(o[field]);\n\t\treturn true;\n\t}\n\n\tpublic static function copy( o : T ) : T {\n\t\tvar o2 : Dynamic = {};\n\t\tfor( f in Reflect.fields(o) )\n\t\t\tReflect.setField(o2,f,Reflect.field(o,f));\n\t\treturn o2;\n\t}\n\n\t@:overload(function( f : Array -> Void ) : Dynamic {})\n\tpublic static function makeVarArgs( f : Array -> Dynamic ) : Dynamic {\n\t\treturn function() {\n\t\t\tvar a = untyped Array.prototype.slice.call(__js__(\"arguments\"));\n\t\t\treturn f(a);\n\t\t};\n\t}\n\n}\n","package audio;\n\nimport pixi.core.text.DefaultStyle;\nimport pixi.interaction.EventTarget;\nimport pixi.core.graphics.Graphics;\nimport pixi.core.math.shapes.Rectangle;\nimport pixi.core.text.Text;\nimport pixi.core.display.Container;\nimport msignal.Signal;\n\nclass Button extends Container {\n\n\tpublic static inline var OVER_COLOUR:Int = 0xDF7401;\n\tpublic static inline var OUT_COLOUR:Int = 0x2E64FE;\n\tpublic static inline var TEXT_COLOUR:String = \"#FFFFFF\";\n\tpublic static inline var FONT_SIZE:Int = 12;\n\n\tvar _data:Dynamic;\n\n\tvar _label:Text;\n\tvar _rect:Rectangle;\n\tvar _background:Graphics;\n\n\tvar _enabled:Bool;\n\n\tpublic var action:Signal1;\n\n\tpublic function new(label:String, width:Float, height:Float, ?data:Dynamic, ?fontSize:Int) {\n\t\tsuper();\n\t\taction = new Signal1(Dynamic);\n\t\t_data = data;\n\t\t_setupBackground(width, height);\n\t\t_setupLabel(width, height, fontSize);\n\t\tsetText(label);\n\t}\n\n\tfunction _setupBackground(width:Float, height:Float) {\n\t\t_rect = new Rectangle(0, 0, width, height);\n\t\t_background = new Graphics();\n\t\t_background.interactive = true;\n\t\t_redraw(Button.OUT_COLOUR);\n\t\taddChild(_background);\n\n\t\t_background.interactive = true;\n\t\t_background.on(\"mouseover\", _onMouseOver);\n\t\t_background.on(\"mouseout\", _onMouseOut);\n\t\t_background.on(\"mousedown\", _onMouseDown);\n\t\t_background.on(\"mouseup\", _onMouseUp);\n\t\t_background.on(\"mouseupoutside\", _onMouseUpOutside);\n\t\t_background.on(\"touchstart\", _onTouchStart);\n\t\t_background.on(\"touchend\", _onTouchEnd);\n\t\t_background.on(\"touchendoutside\", _onTouchEndOutside);\n\t}\n\n\tfunction _setupLabel(width:Float, height:Float, fontSize:Int) {\n\t\tvar size:Int = (fontSize != null) ? fontSize : Button.FONT_SIZE;\n\t\tvar style:DefaultStyle = {};\n\t\tstyle.fontSize = size;\n\t\tstyle.fontFamily = \"Arial\";\n\t\tstyle.fill = Button.TEXT_COLOUR;\n\t\t_label = new Text(\"\", style);\n\t\t_label.anchor.set(0.5);\n\t\t_label.x = width / 2;\n\t\t_label.y = height / 2;\n\t\taddChild(_label);\n\t}\n\n\tfunction _redraw(colour:Int) {\n\t\tvar border:Float = 1;\n\t\t_background.clear();\n\t\t_background.beginFill(0x003366);\n\t\t_background.drawRect(_rect.x, _rect.y, _rect.width, _rect.height);\n\t\t_background.endFill();\n\t\t_background.beginFill(colour);\n\t\t_background.drawRect(_rect.x + border / 2, _rect.y + border / 2, _rect.width - border, _rect.height - border);\n\t\t_background.endFill();\n\t}\n\n\tpublic inline function setText(label:String) {\n\t\t_label.text = label;\n\t}\n\n\tfunction _onMouseDown(target:EventTarget) {\n\t\tif (_enabled) _redraw(Button.OVER_COLOUR);\n\t}\n\n\tfunction _onMouseUp(target:EventTarget) {\n\t\tif (_enabled) {\n\t\t\taction.dispatch(_data);\n\t\t\t_redraw(Button.OUT_COLOUR);\n\t\t}\n\t}\n\n\tfunction _onMouseUpOutside(target:EventTarget) {\n\t\tif (_enabled) _redraw(Button.OUT_COLOUR);\n\t}\n\n\tfunction _onMouseOver(target:EventTarget) {\n\t\tif (_enabled) _redraw(Button.OVER_COLOUR);\n\t}\n\n\tfunction _onMouseOut(target:EventTarget) {\n\t\tif (_enabled) _redraw(Button.OUT_COLOUR);\n\t}\n\n\tfunction _onTouchEndOutside(target:EventTarget) {\n\t\tif (_enabled) _redraw(Button.OUT_COLOUR);\n\t}\n\n\tfunction _onTouchEnd(target:EventTarget) {\n\t\tif (_enabled) {\n\t\t\t_redraw(Button.OUT_COLOUR);\n\t\t\taction.dispatch(_data);\n\t\t}\n\t}\n\n\tfunction _onTouchStart(target:EventTarget) {\n\t\tif (_enabled) _redraw(Button.OVER_COLOUR);\n\t}\n\n\tpublic inline function enable() {\n\t\t_enabled = true;\n\t}\n\n\tpublic function disable() {\n\t\t_redraw(Button.OUT_COLOUR);\n\t\t_enabled = false;\n\t}\n}","package pixi.plugins.app;\n\nimport pixi.core.renderers.SystemRenderer;\nimport js.html.Event;\nimport pixi.core.RenderOptions;\nimport pixi.core.display.Container;\nimport js.html.Element;\nimport js.html.CanvasElement;\nimport js.Browser;\n\n/**\n * Pixi Boilerplate Helper class that can be used by any application\n * @author Adi Reddy Mora\n * http://adireddy.github.io\n * @license MIT\n * @copyright 2015\n */\nclass Application {\n\n\t/**\n * Sets the pixel ratio of the application.\n * default - 1\n */\n\tpublic var pixelRatio:Float;\n\n\t/**\n\t * Width of the application.\n\t * default - Browser.window.innerWidth\n\t */\n\tpublic var width:Float;\n\n\t/**\n\t * Height of the application.\n\t * default - Browser.window.innerHeight\n\t */\n\tpublic var height:Float;\n\n\t/**\n\t * Position of canvas element\n\t * default - static\n\t */\n\tpublic var position:String;\n\n\t/**\n\t * Renderer transparency property.\n\t * default - false\n\t */\n\tpublic var transparent:Bool;\n\n\t/**\n\t * Graphics antialias property.\n\t * default - false\n\t */\n\tpublic var antialias:Bool;\n\n\t/**\n\t * Force FXAA shader antialias instead of native (faster).\n\t * default - false\n\t */\n\tpublic var forceFXAA:Bool;\n\n\t/**\n\t * Force round pixels.\n\t * default - false\n\t */\n\tpublic var roundPixels:Bool;\n\n\t/**\n\t * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.\n * If the scene is transparent Pixi will use clearRect to clear the canvas every frame.\n * Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.\n\t * default - true\n\t */\n\tpublic var clearBeforeRender:Bool;\n\n\t/**\n\t * enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context\n\t * default - false\n\t */\n\tpublic var preserveDrawingBuffer:Bool;\n\n\t/**\n\t * Whether you want to resize the canvas and renderer on browser resize.\n\t * Should be set to false when custom width and height are used for the application.\n\t * default - true\n\t */\n\tpublic var autoResize:Bool;\n\n\t/**\n\t * Sets the background color of the stage.\n\t * default - 0xFFFFFF\n\t */\n\tpublic var backgroundColor:Int;\n\n\t/**\n\t * Update listener \tfunction\n\t */\n\tpublic var onUpdate:Float -> Void;\n\n\t/**\n\t * Window resize listener \tfunction\n\t */\n\tpublic var onResize:Void -> Void;\n\n\t/**\n\t * Canvas Element\n\t * Read-only\n\t */\n\tpublic var canvas(default, null):CanvasElement;\n\n\t/**\n\t * Renderer\n\t * Read-only\n\t */\n\tpublic var renderer(default, null):SystemRenderer;\n\n\t/**\n\t * Global Container.\n\t * Read-only\n\t */\n\tpublic var stage(default, null):Container;\n\n\t/**\n\t * Pixi Application\n\t * Read-only\n\t */\n\tpublic var app(default, null):pixi.core.Application;\n\n\tpublic static inline var AUTO:String = \"auto\";\n\tpublic static inline var RECOMMENDED:String = \"recommended\";\n\tpublic static inline var CANVAS:String = \"canvas\";\n\tpublic static inline var WEBGL:String = \"webgl\";\n\n\tpublic static inline var POSITION_STATIC:String = \"static\";\n\tpublic static inline var POSITION_ABSOLUTE:String = \"absolute\";\n\tpublic static inline var POSITION_FIXED:String = \"fixed\";\n\tpublic static inline var POSITION_RELATIVE:String = \"relative\";\n\tpublic static inline var POSITION_INITIAL:String = \"initial\";\n\tpublic static inline var POSITION_INHERIT:String = \"inherit\";\n\n\tvar _frameCount:Int;\n\tvar _animationFrameId:Null;\n\n\tpublic function new() {\n\t\t_setDefaultValues();\n\t}\n\n\tinline function _setDefaultValues() {\n\t\t_animationFrameId = null;\n\t\tpixelRatio = 1;\n\t\tautoResize = true;\n\t\ttransparent = false;\n\t\tantialias = false;\n\t\tforceFXAA = false;\n\t\troundPixels = false;\n\t\tclearBeforeRender = true;\n\t\tpreserveDrawingBuffer = false;\n\t\tbackgroundColor = 0xFFFFFF;\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tposition = \"static\";\n\t}\n\n\t/**\n\t * Starts pixi application setup using the properties set or default values\n\t * @param [rendererType] - Renderer type to use AUTO (default) | CANVAS | WEBGL\n\t * @param [stats] - Enable/disable stats for the application.\n\t * Note that stats.js is not part of pixi so don't forget to include it you html page\n\t * Can be found in libs folder. \"libs/stats.min.js\" \n\t * @param [parentDom] - By default canvas will be appended to body or it can be appended to custom element if passed\n\t */\n\n\tpublic function start(?rendererType:String = \"auto\", ?parentDom:Element, ?canvasElement:CanvasElement) {\n\t\tif (canvasElement == null) {\n\t\t\tcanvas = Browser.document.createCanvasElement();\n\t\t\tcanvas.style.width = width + \"px\";\n\t\t\tcanvas.style.height = height + \"px\";\n\t\t\tcanvas.style.position = position;\n\t\t}\n\t\telse canvas = canvasElement;\n\n\t\tif (autoResize) Browser.window.onresize = _onWindowResize;\n\n\t\tvar renderingOptions:RenderOptions = {};\n\t\trenderingOptions.view = canvas;\n\t\trenderingOptions.backgroundColor = backgroundColor;\n\t\trenderingOptions.resolution = pixelRatio;\n\t\trenderingOptions.antialias = antialias;\n\t\trenderingOptions.forceFXAA = forceFXAA;\n\t\trenderingOptions.autoResize = autoResize;\n\t\trenderingOptions.transparent = transparent;\n\t\trenderingOptions.clearBeforeRender = clearBeforeRender;\n\t\trenderingOptions.preserveDrawingBuffer = preserveDrawingBuffer;\n\t\trenderingOptions.roundPixels = roundPixels;\n\n\t\tswitch (rendererType) {\n\t\t\tcase CANVAS: app = new pixi.core.Application(width, height, renderingOptions, true);\n\t\t\tdefault: app = new pixi.core.Application(width, height, renderingOptions);\n\t\t}\n\n\t\tstage = app.stage;\n\t\trenderer = app.renderer;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(app.view);\n\t\telse parentDom.appendChild(app.view);\n\n\t\tapp.ticker.add(_onRequestAnimationFrame);\n\n\t\t#if stats addStats(); #end\n\t}\n\n\tpublic function pauseRendering() {\n\t\tapp.stop();\n\t}\n\n\tpublic function resumeRendering() {\n\t\tapp.start();\n\t}\n\n\t@:noCompletion function _onWindowResize(event:Event) {\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tapp.renderer.resize(width, height);\n\t\tcanvas.style.width = width + \"px\";\n\t\tcanvas.style.height = height + \"px\";\n\n\t\tif (onResize != null) onResize();\n\t}\n\n\t@:noCompletion function _onRequestAnimationFrame() {\n\t\tif (onUpdate != null) onUpdate(app.ticker.deltaTime);\n\t}\n\n\tpublic function addStats() {\n\t\tif (untyped __js__(\"window\").Perf != null) {\n\t\t\tnew Perf().addInfo([\"UNKNOWN\", \"WEBGL\", \"CANVAS\"][app.renderer.type] + \" - \" + pixelRatio);\n\t\t}\n\t}\n}","package audio;\n\nimport core.AudioAsset;\nimport core.AssetLoader;\nimport pixi.loaders.Loader;\nimport pixi.core.display.Container;\nimport pixi.core.sprites.Sprite;\nimport pixi.plugins.app.Application;\nimport js.Browser;\n\nclass Main extends Application {\n\n\tvar _loader:AssetLoader;\n\tvar _img:Sprite;\n\tvar _baseURL:String;\n\n\tvar _btnContainer:Container;\n\n\tvar _bgSound:AudioAsset;\n\tvar _sound1:AudioAsset;\n\tvar _sound2:AudioAsset;\n\n\tpublic function new() {\n\t\tsuper();\n\t\tpixelRatio = Math.floor(Browser.window.devicePixelRatio);\n\t\tbackgroundColor = 0x5F04B4;\n\t\tsuper.start();\n\n\t\t_baseURL = \"assets/audio/\";\n\n\t\t_loader = new AssetLoader();\n\t\t_loader.baseUrl = _baseURL;\n\n\t\t_loader.addAudioAsset(\"loop\", \"loop.mp3\");\n\t\t_loader.addAudioAsset(\"sound1\", \"sound1.wav\");\n\t\t_loader.addAudioAsset(\"sound2\", \"sound2.wav\");\n\t\t_loader.start(_onLoaded, _onLoadProgress);\n\n\t\t_btnContainer = new Container();\n\t\tstage.addChild(_btnContainer);\n\t}\n\n\tfunction _onLoadProgress() {\n\t\ttrace(\"Loaded: \" + Math.round(_loader.progress));\n\t}\n\n\tfunction _onLoaded() {\n\t\t_bgSound = _loader.getAudio(\"loop\");\n\t\t_bgSound.loop = true;\n\t\t_bgSound.play();\n\n\t\t_sound1 = _loader.getAudio(\"sound1\");\n\t\t_sound2 = _loader.getAudio(\"sound2\");\n\n\t\t_addButton(\"SOUND 1\", 0, 0, 100, 30, _playSound1);\n\t\t_addButton(\"SOUND 2\", 100, 0, 100, 30, _playSound2);\n\t\t_addButton(\"STOP ALL\", 220, 0, 100, 30, _stopAll);\n\t\t_btnContainer.position.set((Browser.window.innerWidth - 320) / 2, (Browser.window.innerHeight - 30) / 2);\n\t}\n\n\tinline function _playSound1() {\n\t\t_sound1.play();\n\t}\n\n\tinline function _playSound2() {\n\t\t_sound2.play();\n\t}\n\n\tfunction _stopAll() {\n\t\t_bgSound.stop();\n\t\t_sound1.stop();\n\t\t_sound2.stop();\n\t}\n\n\tfunction _addButton(label:String, x:Float, y:Float, width:Float, height:Float, callback:Dynamic) {\n\t\tvar button = new Button(label, width, height);\n\t\tbutton.position.set(x, y);\n\t\tbutton.action.add(callback);\n\t\tbutton.enable();\n\t\t_btnContainer.addChild(button);\n\t}\n\n\tstatic function main() {\n\t\tnew Main();\n\t}\n}","package core;\n\nimport pixi.loaders.Resource;\nimport pixi.core.textures.Texture;\nimport pixi.loaders.Loader;\n\nclass AssetLoader extends Loader {\n\n\tpublic var pixelRatio(null, default):Float;\n\tpublic var count(default, null):Int;\n\tpublic var resolution(default, default):String;\n\tpublic var mute(default, set):Bool;\n\n\tvar _audioAssets:Map;\n\n\tpublic function new() {\n\t\tsuper();\n\t\tcount = 0;\n\t\tpixelRatio = 1;\n\t\t_audioAssets = new Map();\n\t\tMultipackParser.loader = this;\n\t\tuse(MultipackParser.parse);\n\t}\n\n\tpublic function start(?onComplete:Void -> Void, ?onProgress:Void -> Void) {\n\t\tload(onComplete);\n\t\tif (progress != null) on(\"progress\", onProgress);\n\t}\n\n\tpublic inline function addAudioAsset(id:String, path:String, ?onAssetLoaded:Resource -> Void) {\n\t\taddAsset(id, path, false, onAssetLoaded);\n\t}\n\n\tpublic function addAsset(id:String, path:String, ?usePixelRatio:Bool = true, ?onAssetLoaded:Resource -> Void) {\n\t\tif (!exists(id)) {\n\t\t\tvar url:String = path;\n\n\t\t\tif (url != \"\") {\n\t\t\t\tadd(id, url, { loadType: _getLoadtype(path) }, onAssetLoaded);\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic inline function getUrl(id:String):String {\n\t\treturn Reflect.field(resources, id) != null ? Reflect.field(resources, id).url : null;\n\t}\n\n\t@SuppressWarnings(\"checkstyle:Dynamic\")\n\tpublic function getJson(id:String):Dynamic {\n\t\tvar resource:Resource = Reflect.field(resources, id);\n\t\tif (resource != null && ~/(json|text|txt)/i.match(resource.xhrType)) return resource.data;\n\t\treturn null;\n\t}\n\n\tpublic function getTexture(id:String):Texture {\n\t\tvar resource:Resource = Reflect.field(resources, id);\n\t\tif (resource != null && resource.texture != null) return resource.texture;\n\t\treturn null;\n\t}\n\n\tpublic function getTextureFromSpritesheet(id:String, frame:String):Texture {\n\t\tvar resource:Resource = Reflect.field(resources, id);\n\t\tif (resource != null && resource.isJson && resource.textures != null) {\n\t\t\tvar texture = Reflect.field(resource.textures, frame);\n\t\t\tif (texture != null) return texture;\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic inline function exists(id:String):Bool {\n\t\treturn (Reflect.field(resources, id) != null);\n\t}\n\n\tpublic function getAudio(id:String):AudioAsset {\n\t\tif (_audioAssets.get(id) == null) _audioAssets.set(id, new AudioAsset(Reflect.field(resources, id).data));\n\t\treturn _audioAssets.get(id);\n\t}\n\n\tpublic function getResource(id:String):Resource {\n\t\treturn Reflect.field(resources, id);\n\t}\n\n\toverride public function reset() {\n\t\tremoveAllListeners();\n\t\tcount = 0;\n\t\tresources = {};\n\t\tsuper.reset();\n\t}\n\n\tpublic inline function getResoultionPath():String {\n\t\treturn (resolution != null) ? resolution + \"/\" : \"\";\n\t}\n\n\tpublic inline function getPixelRatioPath(?val:Float):String {\n\t\treturn (val != null) ? \"scale-\" + val + \"/\" : \"scale-\" + pixelRatio + \"/\";\n\t}\n\n\tfunction set_mute(val:Bool):Bool {\n\t\tfor (audioAsset in _audioAssets) audioAsset.mute = val;\n\t\treturn mute = val;\n\t}\n\n\t//type: XHR: 1, IMAGE: 2, AUDIO: 3, VIDEO: 4\n\n\tfunction _getLoadtype(asset:String):Int {\n\t\tif (~/(.png|.gif|.svg|.jpg|.jpeg|.bmp)/i.match(asset)) return 2;\n\t\telse if (~/(.mp3|.wav|.ogg|.aac|.m4a|.oga|.webma)/i.match(asset)) return 3;\n\t\telse if (~/(.mp4|.webm|.m3u8)/i.match(asset)) return 4;\n\t\treturn 1;\n\t}\n}\n","package core;\n\nimport js.html.Audio;\n\nclass AudioAsset {\n\n\tpublic var mute:Bool;\n\tpublic var loop(default, set):Bool;\n\n\tvar _src:Audio;\n\n\tpublic function new(src:Audio) {\n\t\t_src = src;\n\t\tmute = false;\n\t\tloop = false;\n\t}\n\n\tpublic function play() {\n\t\tif (!mute) _src.play();\n\t}\n\n\tpublic function stop() {\n\t\t_src.pause();\n\t}\n\n\tfunction set_loop(val:Bool):Bool {\n\t\t_src.loop = val;\n\t\treturn loop = val;\n\t}\n}","package core;\n\nimport pixi.loaders.Resource;\nimport pixi.core.utils.Utils;\nimport pixi.core.math.shapes.Rectangle;\nimport pixi.core.textures.Texture;\n\nclass MultipackParser {\n\n\tpublic static var loader:AssetLoader;\n\n\tpublic static function parse(resource:Resource, next:Void -> Void) {\n\t\tvar data:MultipackSpriteSheet = resource.data;\n\t\tif (data != null && data.multipack) {\n\t\t\tvar textures:Array = data.textures;\n\t\t\tvar imgCount:Int = textures.length;\n\t\t\tvar imgLoadedCount:Int = 0;\n\t\t\tvar resolution:Float = Utils.getResolutionOfUrl(resource.url);\n\n\t\t\tvar baseURL:String = resource.url.split(loader.baseUrl)[1];\n\t\t\tbaseURL = baseURL.substring(0, baseURL.lastIndexOf(\"/\") + 1);\n\n\t\t\tfor (texture in textures) {\n\t\t\t\tvar url:String = baseURL + texture.meta.image;\n\t\t\t\tloader.add(texture.meta.image, url, { loadType: 2, crossOrigin:resource.crossOrigin }, function(image:Resource) {\n\n\t\t\t\t\tvar frames:Array = texture.frames;\n\t\t\t\t\tfor (n in Reflect.fields(frames)) {\n\t\t\t\t\t\tvar frameData:FrameData = Reflect.field(frames, n);\n\t\t\t\t\t\tvar rect = frameData.frame;\n\t\t\t\t\t\tif (rect != null) {\n\t\t\t\t\t\t\tvar size:Rectangle = new Rectangle(rect.x, rect.y, rect.w, rect.h);\n\t\t\t\t\t\t\tvar trim:Rectangle = null;\n\n\t\t\t\t\t\t\tif (frameData.trimmed) {\n\t\t\t\t\t\t\t\tvar actualSize = frameData.sourceSize;\n\t\t\t\t\t\t\t\tvar realSize = frameData.spriteSourceSize;\n\t\t\t\t\t\t\t\ttrim = new Rectangle(realSize.x / resolution, realSize.y / resolution, actualSize.w / resolution, actualSize.h / resolution);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsize.x /= resolution;\n\t\t\t\t\t\t\tsize.y /= resolution;\n\t\t\t\t\t\t\tsize.width /= resolution;\n\t\t\t\t\t\t\tsize.height /= resolution;\n\n\t\t\t\t\t\t\tTexture.addTextureToCache(new Texture(image.texture.baseTexture, size, size.clone(), trim), n);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tnext();\n\t\t}\n\t\telse next();\n\t}\n}\n\ntypedef MultipackSpriteSheet = {\n\tvar multipack:Bool;\n\tvar textures:Array;\n}\n\ntypedef MultipackTexture = {\n\tvar frames:Array;\n\tvar meta:MetaData;\n}\n\ntypedef FrameData = {\n\tvar frame:Frame;\n\tvar rotated:Bool;\n\tvar trimmed:Bool;\n\tvar format:String;\n\tvar spriteSourceSize:SpriteSourceSize;\n\tvar sourceSize:SourceSize;\n}\n\ntypedef Frame = {\n\tvar x:Float;\n\tvar y:Float;\n\tvar w:Float;\n\tvar h:Float;\n}\n\ntypedef SpriteSourceSize = {\n\tvar x:Float;\n\tvar y:Float;\n\tvar w:Float;\n\tvar h:Float;\n}\n\ntypedef SourceSize = {\n\tvar w:Float;\n\tvar h:Float;\n}\n\ntypedef MetaData = {\n\tvar app:String;\n\tvar version:String;\n\tvar image:String;\n\tvar format:String;\n\tvar size:String;\n\tvar scale:String;\n\tvar smartupdate:String;\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\npackage haxe.ds;\n\nprivate class StringMapIterator {\n\tvar map : StringMap;\n\tvar keys : Array;\n\tvar index : Int;\n\tvar count : Int;\n\tpublic inline function new(map:StringMap, keys:Array) {\n\t\tthis.map = map;\n\t\tthis.keys = keys;\n\t\tthis.index = 0;\n\t\tthis.count = keys.length;\n\t}\n\tpublic inline function hasNext() {\n\t\treturn index < count;\n\t}\n\tpublic inline function next() {\n\t\treturn map.get(keys[index++]);\n\t}\n}\n\n@:coreApi class StringMap implements haxe.Constraints.IMap {\n\n\tprivate var h : Dynamic;\n\tprivate var rh : Dynamic;\n\n\tpublic inline function new() : Void {\n\t\th = {};\n\t}\n\n\tinline function isReserved(key:String) : Bool {\n\t\treturn untyped __js__(\"__map_reserved\")[key] != null;\n\t}\n\n\tpublic inline function set( key : String, value : T ) : Void {\n\t\tif( isReserved(key) )\n\t\t\tsetReserved(key, value);\n\t\telse\n\t\t\th[cast key] = value;\n\t}\n\n\tpublic inline function get( key : String ) : Null {\n\t\tif( isReserved(key) )\n\t\t\treturn getReserved(key);\n\t\treturn h[cast key];\n\t}\n\n\tpublic inline function exists( key : String ) : Bool {\n\t\tif( isReserved(key) )\n\t\t\treturn existsReserved(key);\n\t\treturn h.hasOwnProperty(key);\n\t}\n\n\tfunction setReserved( key : String, value : T ) : Void {\n\t\tif( rh == null ) rh = {};\n\t\trh[cast \"$\"+key] = value;\n\t}\n\n\tfunction getReserved( key : String ) : Null {\n\t\treturn rh == null ? null : rh[cast \"$\"+key];\n\t}\n\n\tfunction existsReserved( key : String ) : Bool {\n\t\tif( rh == null ) return false;\n\t\treturn untyped rh.hasOwnProperty(\"$\"+key);\n\t}\n\n\tpublic function remove( key : String ) : Bool {\n\t\tif( isReserved(key) ) {\n\t\t\tkey = \"$\" + key;\n\t\t\tif( rh == null || !rh.hasOwnProperty(key) ) return false;\n\t\t\tuntyped __js__(\"delete\")(rh[key]);\n\t\t\treturn true;\n\t\t} else {\n\t\t\tif( !h.hasOwnProperty(key) )\n\t\t\t\treturn false;\n\t\t\tuntyped __js__(\"delete\")(h[key]);\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tpublic function keys() : Iterator {\n\t\treturn arrayKeys().iterator();\n\t}\n\t\n\tfunction arrayKeys() : Array {\n\t\tvar out = [];\n\t\tuntyped {\n\t\t\t__js__(\"for( var key in this.h ) {\");\n\t\t\t\tif( h.hasOwnProperty(key) )\n\t\t\t\t\tout.push(key);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\tif( rh != null ) untyped {\n\t\t\t__js__(\"for( var key in this.rh ) {\");\n\t\t\t\tif( key.charCodeAt(0) == \"$\".code )\n\t\t\t\t\tout.push(key.substr(1));\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn out;\n\t}\n\n\tpublic inline function iterator() : Iterator {\n\t\treturn new StringMapIterator(this, arrayKeys());\n\t}\n\n\tpublic function toString() : String {\n\t\tvar s = new StringBuf();\n\t\ts.add(\"{\");\n\t\tvar keys = arrayKeys();\n\t\tfor( i in 0...keys.length ) {\n\t\t\tvar k = keys[i];\n\t\t\ts.add(k);\n\t\t\ts.add(\" => \");\n\t\t\ts.add(Std.string(get(k)));\n\t\t\tif( i < keys.length )\n\t\t\t\ts.add(\", \");\n\t\t}\n\t\ts.add(\"}\");\n\t\treturn s.toString();\n\t}\n\n\tstatic function __init__() : Void {\n\t\tuntyped __js__(\"var __map_reserved = {}\");\n\t}\n\n}\n","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\npackage js;\n\nprivate class HaxeError extends js.Error {\n\n\tvar val:Dynamic;\n\n\tpublic function new(val:Dynamic) untyped {\n\t\tsuper();\n\t\tthis.val = __define_feature__(\"js.Boot.HaxeError\", val);\n\t\tthis.message = String(val);\n\t\tif (js.Error.captureStackTrace) js.Error.captureStackTrace(this, HaxeError);\n\t}\n}\n\n@:dox(hide)\nclass Boot {\n\n\tprivate static function __unhtml(s : String) {\n\t\treturn s.split(\"&\").join(\"&\").split(\"<\").join(\"<\").split(\">\").join(\">\");\n\t}\n\n\tprivate static function __trace(v,i : haxe.PosInfos) {\n\t\tuntyped {\n\t\t\tvar msg = if( i != null ) i.fileName+\":\"+i.lineNumber+\": \" else \"\";\n\t\t\t#if jsfl\n\t\t\tmsg += __string_rec(v,\"\");\n\t\t\tfl.trace(msg);\n\t\t\t#else\n\t\t\tmsg += __string_rec(v, \"\");\n\t\t\tif( i != null && i.customParams != null )\n\t\t\t\tfor( v in i.customParams )\n\t\t\t\t\tmsg += \",\" + __string_rec(v, \"\");\n\t\t\tvar d;\n\t\t\tif( __js__(\"typeof\")(document) != \"undefined\" && (d = document.getElementById(\"haxe:trace\")) != null )\n\t\t\t\td.innerHTML += __unhtml(msg)+\"
\";\n\t\t\telse if( __js__(\"typeof console\") != \"undefined\" && __js__(\"console\").log != null )\n\t\t\t\t__js__(\"console\").log(msg);\n\t\t\t#end\n\t\t}\n\t}\n\n\tprivate static function __clear_trace() {\n\t\tuntyped {\n\t\t\t#if jsfl\n\t\t\tfl.outputPanel.clear();\n\t\t\t#else\n\t\t\tvar d = document.getElementById(\"haxe:trace\");\n\t\t\tif( d != null )\n\t\t\t\td.innerHTML = \"\";\n\t\t\t#end\n\t\t}\n\t}\n\n\tstatic inline function isClass(o:Dynamic) : Bool {\n\t\treturn untyped __define_feature__(\"js.Boot.isClass\", o.__name__);\n\t}\n\n\tstatic inline function isEnum(e:Dynamic) : Bool {\n\t\treturn untyped __define_feature__(\"js.Boot.isEnum\", e.__ename__);\n\t}\n\n\tstatic function getClass(o:Dynamic) : Dynamic {\n\t\tif (Std.is(o, Array))\n\t\t\treturn Array;\n\t\telse {\n\t\t\tvar cl = untyped __define_feature__(\"js.Boot.getClass\", o.__class__);\n\t\t\tif (cl != null)\n\t\t\t\treturn cl;\n\t\t\tvar name = __nativeClassName(o);\n\t\t\tif (name != null)\n\t\t\t\treturn __resolveNativeClass(name);\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t@:ifFeature(\"has_enum\")\n\tprivate static function __string_rec(o,s:String) {\n\t\tuntyped {\n\t\t\tif( o == null )\n\t\t\t return \"null\";\n\t\t\tif( s.length >= 5 )\n\t\t\t\treturn \"<...>\"; // too much deep recursion\n\t\t\tvar t = __js__(\"typeof(o)\");\n\t\t\tif( t == \"function\" && (isClass(o) || isEnum(o)) )\n\t\t\t\tt = \"object\";\n\t\t\tswitch( t ) {\n\t\t\tcase \"object\":\n\t\t\t\tif( __js__(\"o instanceof Array\") ) {\n\t\t\t\t\tif( o.__enum__ ) {\n\t\t\t\t\t\tif( o.length == 2 )\n\t\t\t\t\t\t\treturn o[0];\n\t\t\t\t\t\tvar str = o[0]+\"(\";\n\t\t\t\t\t\ts += \"\\t\";\n\t\t\t\t\t\tfor( i in 2...o.length ) {\n\t\t\t\t\t\t\tif( i != 2 )\n\t\t\t\t\t\t\t\tstr += \",\" + __string_rec(o[i],s);\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tstr += __string_rec(o[i],s);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn str + \")\";\n\t\t\t\t\t}\n\t\t\t\t\tvar l = o.length;\n\t\t\t\t\tvar i;\n\t\t\t\t\tvar str = \"[\";\n\t\t\t\t\ts += \"\\t\";\n\t\t\t\t\tfor( i in 0...l )\n\t\t\t\t\t\tstr += (if (i > 0) \",\" else \"\")+__string_rec(o[i],s);\n\t\t\t\t\tstr += \"]\";\n\t\t\t\t\treturn str;\n\t\t\t\t}\n\t\t\t\tvar tostr;\n\t\t\t\ttry {\n\t\t\t\t\ttostr = untyped o.toString;\n\t\t\t\t} catch( e : Dynamic ) {\n\t\t\t\t\t// strange error on IE\n\t\t\t\t\treturn \"???\";\n\t\t\t\t}\n\t\t\t\tif( tostr != null && tostr != __js__(\"Object.toString\") && __typeof__(tostr) == \"function\" ) {\n\t\t\t\t\tvar s2 = o.toString();\n\t\t\t\t\tif( s2 != \"[object Object]\")\n\t\t\t\t\t\treturn s2;\n\t\t\t\t}\n\t\t\t\tvar k : String = null;\n\t\t\t\tvar str = \"{\\n\";\n\t\t\t\ts += \"\\t\";\n\t\t\t\tvar hasp = (o.hasOwnProperty != null);\n\t\t\t\t__js__(\"for( var k in o ) {\");\n\t\t\t\t\tif( hasp && !o.hasOwnProperty(k) )\n\t\t\t\t\t\t__js__(\"continue\");\n\t\t\t\t\tif( k == \"prototype\" || k == \"__class__\" || k == \"__super__\" || k == \"__interfaces__\" || k == \"__properties__\" )\n\t\t\t\t\t\t__js__(\"continue\");\n\t\t\t\t\tif( str.length != 2 )\n\t\t\t\t\t\tstr += \", \\n\";\n\t\t\t\t\tstr += s + k + \" : \"+__string_rec(o[k],s);\n\t\t\t\t__js__(\"}\");\n\t\t\t\ts = s.substring(1);\n\t\t\t\tstr += \"\\n\" + s + \"}\";\n\t\t\t\treturn str;\n\t\t\tcase \"function\":\n\t\t\t\treturn \"\";\n\t\t\tcase \"string\":\n\t\t\t\treturn o;\n\t\t\tdefault:\n\t\t\t\treturn String(o);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static function __interfLoop(cc : Dynamic,cl : Dynamic) {\n\t\tif( cc == null )\n\t\t\treturn false;\n\t\tif( cc == cl )\n\t\t\treturn true;\n\t\tvar intf : Dynamic = cc.__interfaces__;\n\t\tif( intf != null )\n\t\t\tfor( i in 0...intf.length ) {\n\t\t\t\tvar i : Dynamic = intf[i];\n\t\t\t\tif( i == cl || __interfLoop(i,cl) )\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\treturn __interfLoop(cc.__super__,cl);\n\t}\n\n\t@:ifFeature(\"typed_catch\") private static function __instanceof(o : Dynamic,cl : Dynamic) {\n\t\tif( cl == null )\n\t\t\treturn false;\n\t\tswitch( cl ) {\n\t\tcase Int:\n\t\t\treturn (untyped __js__(\"(o|0) === o\"));\n\t\tcase Float:\n\t\t\treturn (untyped __js__(\"typeof\"))(o) == \"number\";\n\t\tcase Bool:\n\t\t\treturn (untyped __js__(\"typeof\"))(o) == \"boolean\";\n\t\tcase String:\n\t\t\treturn (untyped __js__(\"typeof\"))(o) == \"string\";\n\t\tcase Array:\n\t\t\treturn (untyped __js__(\"(o instanceof Array)\")) && o.__enum__ == null;\n\t\tcase Dynamic:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\tif( o != null ) {\n\t\t\t\t// Check if o is an instance of a Haxe class or a native JS object\n\t\t\t\tif( (untyped __js__(\"typeof\"))(cl) == \"function\" ) {\n\t\t\t\t\tif( untyped __js__(\"o instanceof cl\") )\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tif( __interfLoop(getClass(o),cl) )\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse if ( (untyped __js__(\"typeof\"))(cl) == \"object\" && __isNativeObj(cl) ) {\n\t\t\t\t\tif( untyped __js__(\"o instanceof cl\") )\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// do not use isClass/isEnum here\n\t\t\tuntyped __feature__(\"Class.*\",if( cl == Class && o.__name__ != null ) return true);\n\t\t\tuntyped __feature__(\"Enum.*\",if( cl == Enum && o.__ename__ != null ) return true);\n\t\t\treturn o.__enum__ == cl;\n\t\t}\n\t}\n\n\t@:ifFeature(\"typed_cast\") private static function __cast(o : Dynamic, t : Dynamic) {\n\t\tif (__instanceof(o, t)) return o;\n\t\telse throw \"Cannot cast \" +Std.string(o) + \" to \" +Std.string(t);\n\t}\n\n\tstatic var __toStr = untyped __js__(\"{}.toString\");\n\t// get native JS [[Class]]\n\tstatic function __nativeClassName(o:Dynamic):String {\n\t\tvar name = untyped __toStr.call(o).slice(8, -1);\n\t\t// exclude general Object and Function\n\t\t// also exclude Math and JSON, because instanceof cannot be called on them\n\t\tif (name == \"Object\" || name == \"Function\" || name == \"Math\" || name == \"JSON\")\n\t\t\treturn null;\n\t\treturn name;\n\t}\n\n\t// check for usable native JS object\n\tstatic function __isNativeObj(o:Dynamic):Bool {\n\t\treturn __nativeClassName(o) != null;\n\t}\n\n\t// resolve native JS class in the global scope:\n\tstatic function __resolveNativeClass(name:String) {\n\t\treturn untyped js.Lib.global[name];\n\t}\n\n}\n","/*\nCopyright (c) 2012 Massive Interactive\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of \nthis software and associated documentation files (the \"Software\"), to deal in \nthe Software without restriction, including without limitation the rights to \nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies \nof the Software, and to permit persons to whom the Software is furnished to do \nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all \ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE \nSOFTWARE.\n*/\n\npackage msignal;\n\nimport msignal.Slot;\n\n/**\n\tA convenience type describing any kind of signal.\n**/\ntypedef AnySignal = Signal;\n\n/**\n\tA Signal manages a list of listeners, which are executed when the signal is \n\tdispatched.\n**/\n@:keepSub\nclass Signal, TListener>\n{\n\tpublic var valueClasses:Array;\n\n\t/**\n\t\tThe current number of listeners for the signal.\n\t**/\n\tpublic var numListeners(get, null):Int;\n\t\n\tvar slots:SlotList;\n\tvar priorityBased:Bool;\n\n\tfunction new(?valueClasses:Array)\n\t{\n\t\tif (valueClasses == null) valueClasses = [];\n\t\tthis.valueClasses = valueClasses;\n\t\tslots = cast SlotList.NIL;\n\t\tpriorityBased = false;\n\t}\n\n\t/**\n\t\tSubscribes a listener for the signal.\n\t\t\n\t\t@param listener A function matching the signature of TListener\n\t\t@return The added listener slot\n\t**/\n\tpublic function add(listener:TListener):TSlot\n\t{\n\t\treturn registerListener(listener);\n\t}\n\n\t/**\n\t\tSubscribes a one-time listener for this signal.\n\t\tThe signal will remove the listener automatically the first time it is called,\n\t\tafter the dispatch to all listeners is complete.\n\t\t\n\t\t@param listener A function matching the signature of TListener\n\t\t@return The added listener slot\n\t**/\n\tpublic function addOnce(listener:TListener):TSlot\n\t{\n\t\treturn registerListener(listener, true);\n\t}\n\n\t/**\n\t\tSubscribes a listener for the signal.\n\t\tAfter you successfully register an event listener,\n\t\tyou cannot change its priority through additional calls to add().\n\t\tTo change a listener's priority, you must first call remove().\n\t\tThen you can register the listener again with the new priority level.\n\t\t\n\t\t@param listener A function matching the signature of TListener\n\t\t@return The added listener slot\n\t**/\n\tpublic function addWithPriority(listener:TListener, ?priority:Int=0):TSlot\n\t{\n\t\treturn registerListener(listener, false, priority);\n\t}\n\n\t/**\n\t\tSubscribes a one-time listener for this signal.\n\t\tThe signal will remove the listener automatically the first time it is \n\t\tcalled, after the dispatch to all listeners is complete.\n\t\t\n\t\t@param listener A function matching the signature of TListener\n\t\t@return The added listener slot\n\t**/\n\tpublic function addOnceWithPriority(listener:TListener, ?priority:Int=0):TSlot\n\t{\n\t\treturn registerListener(listener, true, priority);\n\t}\n\n\t/**\n\t\tUnsubscribes a listener from the signal.\n\t\t\n\t\t@param listener The listener to remove\n\t\t@return The removed listener slot\n\t**/\n\tpublic function remove(listener:TListener):TSlot\n\t{\n\t\tvar slot = slots.find(listener);\n\t\tif (slot == null) return null;\n\t\t\n\t\tslots = slots.filterNot(listener);\n\t\treturn slot;\n\t}\n\n\t/**\n\t\tUnsubscribes all listeners from the signal.\n\t**/\n\tpublic function removeAll():Void\n\t{\n\t\tslots = cast SlotList.NIL;\n\t}\n\n\tfunction registerListener(listener:TListener, ?once:Bool=false, ?priority:Int=0):TSlot\n\t{\n\t\tif (registrationPossible(listener, once))\n\t\t{\n\t\t\tvar newSlot = createSlot(listener, once, priority);\n\t\t\t\n\t\t\tif (!priorityBased && priority != 0) priorityBased = true;\n\t\t\tif (!priorityBased && priority == 0) slots = slots.prepend(newSlot);\n\t\t\telse slots = slots.insertWithPriority(newSlot);\n\n\t\t\treturn newSlot;\n\t\t}\n\t\t\n\t\treturn slots.find(listener);\n\t}\n\n\tfunction registrationPossible(listener, once)\n\t{\n\t\tif (!slots.nonEmpty) return true;\n\t\t\n\t\tvar existingSlot = slots.find(listener);\n\t\tif (existingSlot == null) return true;\n\n\t\t#if debug\n\t\tif (existingSlot.once != once)\n\t\t{\n\t\t\t// If the listener was previously added, definitely don't add it again.\n\t\t\t// But throw an exception if their once values differ.\n\t\t\tthrow \"You cannot addOnce() then add() the same listener without removing the relationship first.\";\n\t\t}\n\t\t#end\n\t\t\n\t\treturn false; // Listener was already registered.\n\t}\n\n\tfunction createSlot(listener:TListener, ?once:Bool=false, ?priority:Int=0):TSlot\n\t{\n\t\treturn null;\n\t}\n\n\tfunction get_numListeners()\n\t{\n\t\treturn slots.length;\n\t}\n}\n\n/**\n\tSignal that executes listeners with no arguments.\n**/\nclass Signal0 extends Signal Void>\n{\n\tpublic function new()\n\t{\n\t\tsuper();\n\t}\n\n\t/**\n\t\tExecutes the signals listeners with no arguements.\n\t**/\n\tpublic function dispatch()\n\t{\n\t\tvar slotsToProcess = slots;\n\t\t\n\t\twhile (slotsToProcess.nonEmpty)\n\t\t{\n\t\t\tslotsToProcess.head.execute();\n\t\t\tslotsToProcess = slotsToProcess.tail;\n\t\t}\n\t}\n\n\toverride function createSlot(listener:Void -> Void, ?once:Bool=false, ?priority:Int=0)\n\t{\n\t\treturn new Slot0(this, listener, once, priority);\n\t}\n}\n\n/**\n\tSignal that executes listeners with one arguments.\n**/\nclass Signal1 extends Signal, TValue -> Void>\n{\n\tpublic function new(?type:Dynamic=null)\n\t{\n\t\tsuper([type]);\n\t}\n\n\t/**\n\t\tExecutes the signals listeners with one arguement.\n\t**/\n\tpublic function dispatch(value:TValue)\n\t{\n\t\tvar slotsToProcess = slots;\n\t\t\n\t\twhile (slotsToProcess.nonEmpty)\n\t\t{\n\t\t\tslotsToProcess.head.execute(value);\n\t\t\tslotsToProcess = slotsToProcess.tail;\n\t\t}\n\t}\n\n\toverride function createSlot(listener:TValue -> Void, ?once:Bool=false, ?priority:Int=0)\n\t{\n\t\treturn new Slot1(this, listener, once, priority);\n\t}\n}\n\n/**\n\tSignal that executes listeners with two arguments.\n**/\nclass Signal2 extends Signal, TValue1 -> TValue2 -> Void>\n{\n\tpublic function new(?type1:Dynamic=null, ?type2:Dynamic=null)\n\t{\n\t\tsuper([type1, type2]);\n\t}\n\n\t/**\n\t\tExecutes the signals listeners with two arguements.\n\t**/\n\tpublic function dispatch(value1:TValue1, value2:TValue2)\n\t{\n\t\tvar slotsToProcess = slots;\n\t\t\n\t\twhile (slotsToProcess.nonEmpty)\n\t\t{\n\t\t\tslotsToProcess.head.execute(value1, value2);\n\t\t\tslotsToProcess = slotsToProcess.tail;\n\t\t}\n\t}\n\n\toverride function createSlot(listener:TValue1 -> TValue2 -> Void, ?once:Bool=false, ?priority:Int=0)\n\t{\n\t\treturn new Slot2(this, listener, once, priority);\n\t}\n}\n","/*\nCopyright (c) 2012 Massive Interactive\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of \nthis software and associated documentation files (the \"Software\"), to deal in \nthe Software without restriction, including without limitation the rights to \nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies \nof the Software, and to permit persons to whom the Software is furnished to do \nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all \ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE \nSOFTWARE.\n*/\n\npackage msignal;\n\nimport msignal.Signal;\n\n/**\n\tA convenience type describing any kind of slot.\n**/\ntypedef AnySlot = Slot;\n\n/**\n\tDefines the basic properties of a listener associated with a Signal.\n**/\n#if haxe3\nclass Slot\n#else\nclass Slot, TListener>\n#end\n{\n\t/**\n\t\tThe listener associated with this slot.\n\t\tNote: for hxcpp 2.10 this requires a getter method to compile\n\t**/\n\t#if cpp\n\t#if haxe3 @:isVar #end\n\tpublic var listener(get_listener, set_listener):TListener;\n\t#else\n\t#if haxe3 @:isVar #end\n\tpublic var listener(default, set_listener):TListener;\n\t#end\n\t\n\n\t/**\n\t\tWhether this slot is automatically removed after it has been used once.\n\t**/\n\tpublic var once(default, null):Bool;\n\n\t/**\n\t\tThe priority of this slot should be given in the execution order.\n\t\tAn Signal will call higher numbers before lower ones.\n\t\tDefaults to 0.\n\t**/\n\tpublic var priority(default, null):Int;\n\n\t/**\n\t\tWhether the listener is called on execution. Defaults to true.\n\t**/\n\tpublic var enabled:Bool;\n\n\tvar signal:TSignal;\n\t\n\tfunction new(signal:TSignal, listener:TListener, ?once:Bool=false, ?priority:Int=0)\n\t{\n\t\tthis.signal = signal;\n\t\tthis.listener = listener;\n\t\tthis.once = once;\n\t\tthis.priority = priority;\n\t\tthis.enabled = true;\n\t}\n\n\t/**\n\t\tRemoves the slot from its signal.\n\t**/\n\tpublic function remove()\n\t{\n\t\tsignal.remove(listener);\n\t}\n\n\t#if cpp\n\t/**\n\t\tHxcpp 2.10 requires a getter method for a typed function property in \n\t\torder to compile\n\t**/\n\tfunction get_listener():TListener\n\t{\n\t\treturn listener;\n\t}\n\t#end\n\n\tfunction set_listener(value:TListener):TListener\n\t{\n\t\t#if debug\n\t\tif (value == null) throw \"listener cannot be null\";\n\t\t#end\n\t\treturn listener = value;\n\t}\n}\n\n/**\n\tA slot that executes a listener with no arguments.\n**/\nclass Slot0 extends Slot Void>\n{\n\tpublic function new(signal:Signal0, listener:Void -> Void, ?once:Bool=false, ?priority:Int=0)\n\t{\n\t\tsuper(signal, listener, once, priority);\n\t}\n\n\t/**\n\t\tExecutes a listener with no arguments.\n\t**/\n\tpublic function execute()\n\t{\n\t\tif (!enabled) return;\n\t\tif (once) remove();\n\t\tlistener();\n\t}\n}\n\n/**\n\tA slot that executes a listener with one argument.\n**/\nclass Slot1 extends Slot, TValue -> Void>\n{\n\t/**\n\t\tAllows the slot to inject the argument to dispatch.\n\t**/\n\tpublic var param:TValue;\n\n\tpublic function new(signal:Signal1, listener:TValue -> Void, ?once:Bool=false, ?priority:Int=0)\n\t{\n\t\tsuper(signal, listener, once, priority);\n\t}\n\n\t/**\n\t\tExecutes a listener with one argument.\n\t\tIf param
is not null, it overrides the value provided.\n\t**/\n\tpublic function execute(value1:TValue)\n\t{\n\t\tif (!enabled) return;\n\t\tif (once) remove();\n\t\tif (param != null) value1 = param;\n\t\tlistener(value1);\n\t}\n}\n\n/**\n\tA slot that executes a listener with two arguments.\n**/\nclass Slot2 extends Slot, TValue1 -> TValue2 -> Void>\n{\n\t/**\n\t\tAllows the slot to inject the first argument to dispatch.\n\t**/\n\tpublic var param1:TValue1;\n\n\t/**\n\t\tAllows the slot to inject the second argument to dispatch.\n\t**/\n\tpublic var param2:TValue2;\n\n\tpublic function new(signal:Signal2, listener:TValue1 -> TValue2 -> Void, ?once:Bool=false, ?priority:Int=0)\n\t{\n\t\tsuper(signal, listener, once, priority);\n\t}\n\n\t/**\n\t\tExecutes a listener with two arguments.\n\t\tIf param1
or param2
is set, \n\t\tthey override the values provided.\n\t**/\n\tpublic function execute(value1:TValue1, value2:TValue2)\n\t{\n\t\tif (!enabled) return;\n\t\tif (once) remove();\n\t\t\n\t\tif (param1 != null) value1 = param1;\n\t\tif (param2 != null) value2 = param2;\n\t\t\n\t\tlistener(value1, value2);\n\t}\n}\n","/*\nCopyright (c) 2012 Massive Interactive\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of \nthis software and associated documentation files (the \"Software\"), to deal in \nthe Software without restriction, including without limitation the rights to \nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies \nof the Software, and to permit persons to whom the Software is furnished to do \nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all \ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE \nSOFTWARE.\n*/\n\npackage msignal;\n\nclass SlotList, TListener>\n{\n\t@:IgnoreCover\n\tstatic function __init__() { NIL = new SlotList(null, null); }\n\t\n\t/**\n\t\tRepresents an empty list. Used as the list terminator.\n\t**/\n\tpublic static var NIL:SlotList;\n\t\n\tpublic var head:TSlot;\n\tpublic var tail:SlotList;\n\tpublic var nonEmpty:Bool;\n\t\n\t/**\n\t\tCreates and returns a new SlotList object.\n\n\t\tA user never has to create a SlotList manually. \n\t\tUse the NIL
element to represent an empty list. \n\t\tNIL.prepend(value)
would create a list containing \n\t\tvalue
.\n\n\t\t@param head The first slot in the list.\n\t\t@param tail A list containing all slots except head.\n\t**/\n\tpublic function new(head:TSlot, ?tail:SlotList=null)\n\t{\n\t\tnonEmpty = false;\n\t\t\n\t\tif (head == null && tail == null)\n\t\t{\n\t\t\t#if debug\n\t\t\tif (NIL != null) throw \"Parameters head and tail are null. Use the NIL element instead.\";\n\t\t\t#end\n\n\t\t\t// this is the NIL element as per definition\n\t\t\tnonEmpty = false;\n\t\t}\n\t\telse if (head == null)\n\t\t{\n\t\t\t#if debug\n\t\t\tthrow \"Parameter head cannot be null.\";\n\t\t\t#end\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.head = head;\n\t\t\tthis.tail = (tail == null ? cast NIL : tail);\n\t\t\tnonEmpty = true;\n\t\t}\n\t}\n\t\n\t/**\n\t\tThe number of slots in the list.\n\t**/\n\tpublic var length(get_length, null):Int;\n\tfunction get_length():Int\n\t{\n\t\tif (!nonEmpty) return 0;\n\t\tif (tail == NIL) return 1;\n\t\t\n\t\t// We could cache the length, but it would make methods like filterNot unnecessarily complicated.\n\t\t// Instead we assume that O(n) is okay since the length property is used in rare cases.\n\t\t// We could also cache the length lazy, but that is a waste of another 8b per list node (at least).\n\t\t\n\t\tvar result = 0;\n\t\tvar p = this;\n\t\t\n\t\twhile (p.nonEmpty)\n\t\t{\n\t\t\t++result;\n\t\t\tp = p.tail;\n\t\t}\n\t\t\n\t\treturn result;\n\t}\n\t\n\t/**\n\t\tPrepends a slot to this list.\n\t\t@param\tslot The item to be prepended.\n\t\t@return\tA list consisting of slot followed by all elements of this list.\n\t**/\n\tpublic function prepend(slot:TSlot)\n\t{\n\t\treturn new SlotList(slot, this);\n\t}\n\t\n\t/**\n\t\tAppends a slot to this list.\n\t\tNote: appending is O(n). Where possible, prepend which is O(1).\n\t\tIn some cases, many list items must be cloned to \n\t\tavoid changing existing lists.\n\t\t@param\tslot The item to be appended.\n\t\t@return\tA list consisting of all elements of this list followed by slot.\n\t**/\n\tpublic function append(slot:TSlot)\n\t{\n\t\tif (slot == null) return this;\n\t\tif (!nonEmpty) return new SlotList(slot);\n\t\t\n\t\t// Special case: just one slot currently in the list.\n\t\tif (tail == NIL) \n\t\t{\n\t\t\treturn new SlotList(slot).prepend(head);\n\t\t}\n\t\t\n\t\t// The list already has two or more slots.\n\t\t// We have to build a new list with cloned items because they are immutable.\n\t\tvar wholeClone = new SlotList(head);\n\t\tvar subClone = wholeClone;\n\t\tvar current = tail;\n\t\t\n\t\twhile (current.nonEmpty)\n\t\t{\n\t\t\tsubClone = subClone.tail = new SlotList(current.head);\n\t\t\tcurrent = current.tail;\n\t\t}\n\t\t\n\t\t// Append the new slot last.\n\t\tsubClone.tail = new SlotList(slot);\n\t\treturn wholeClone;\n\t}\t\t\n\t\n\t/**\n\t\tInsert a slot into the list in a position according to its priority.\n\t\tThe higher the priority, the closer the item will be inserted to the \n\t\tlist head.\n\t\t@param slot The item to be inserted.\n\t**/\n\tpublic function insertWithPriority(slot:TSlot)\n\t{\n\t\tif (!nonEmpty) return new SlotList(slot);\n\t\t\n\t\tvar priority:Int = slot.priority;\n\t\t\n\t\t// Special case: new slot has the highest priority.\n\t\tif (priority >= this.head.priority) return prepend(slot);\n\n\t\tvar wholeClone = new SlotList(head);\n\t\tvar subClone = wholeClone;\n\t\tvar current = tail;\n\n\t\t// Find a slot with lower priority and go in front of it.\n\t\twhile (current.nonEmpty)\n\t\t{\n\t\t\tif (priority > current.head.priority)\n\t\t\t{\n\t\t\t\tsubClone.tail = current.prepend(slot);\n\t\t\t\treturn wholeClone;\n\t\t\t}\n\t\t\t\n\t\t\tsubClone = subClone.tail = new SlotList(current.head);\n\t\t\tcurrent = current.tail;\n\t\t}\n\t\t\n\t\t// Slot has lowest priority.\n\t\tsubClone.tail = new SlotList(slot);\n\t\treturn wholeClone;\n\t}\n\t\n\t/**\n\t\tReturns the slots in this list that do not contain the supplied \n\t\tlistener. Note: assumes the listener is not repeated within the list.\n\t\t@param\tlistener The function to remove.\n\t\t@return A list consisting of all elements of this list that do not \n\t\t\t\thave listener.\n\t**/\n\tpublic function filterNot(listener:TListener)\n\t{\n\t\tif (!nonEmpty || listener == null) return this;\n\t\t\n\t\tif (Reflect.compareMethods(head.listener, listener)) return tail;\n\t\t\n\t\t// The first item wasn't a match so the filtered list will contain it.\n\t\tvar wholeClone = new SlotList(head);\n\t\tvar subClone = wholeClone;\n\t\tvar current = tail;\n\t\t\n\t\twhile (current.nonEmpty)\n\t\t{\n\t\t\tif (Reflect.compareMethods(current.head.listener, listener))\n\t\t\t{\n\t\t\t\t// Splice out the current head.\n\t\t\t\tsubClone.tail = current.tail;\n\t\t\t\treturn wholeClone;\n\t\t\t}\n\t\t\t\n\t\t\tsubClone = subClone.tail = new SlotList(current.head);\n\t\t\tcurrent = current.tail;\n\t\t}\n\t\t\n\t\t// The listener was not found so this list is unchanged.\n\t\treturn this;\n\t}\n\t\n\t/**\n\t\tDetermines whether the supplied listener Function is contained \n\t\twithin this list\n\t**/\n\tpublic function contains(listener:TListener):Bool\n\t{\n\t\tif (!nonEmpty) return false;\n\n\t\tvar p = this;\n\t\twhile (p.nonEmpty)\n\t\t{\n\t\t\tif (Reflect.compareMethods(p.head.listener, listener)) return true;\n\t\t\tp = p.tail;\n\t\t}\n\n\t\treturn false;\n\t}\n\t\n\t/**\n\t\tRetrieves the Slot associated with a supplied listener within the SlotList.\n\t\t@param listener The Function being searched for\n\t\t@return The ISlot in this list associated with the listener parameter \n\t\t\t\t through the ISlot.listener property. Returns null if no such \n\t\t\t\t ISlot instance exists or the list is empty. \n\t**/\n\tpublic function find(listener:TListener):TSlot\n\t{\n\t\tif (!nonEmpty) return null;\n\t\t\n\t\tvar p = this;\n\t\twhile (p.nonEmpty)\n\t\t{\n\t\t\tif (Reflect.compareMethods(p.head.listener, listener)) return p.head;\n\t\t\tp = p.tail;\n\t\t}\n\t\t\n\t\treturn null;\n\t}\n}\n","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport js.Boot;\n\n@:keepInit\n@:coreApi class Std {\n\n\tpublic static inline function is( v : Dynamic, t : Dynamic ) : Bool {\n\t\treturn untyped js.Boot.__instanceof(v,t);\n\t}\n\n\tpublic static inline function instance( value : T, c : Class ) : S {\n\t\treturn untyped __instanceof__(value, c) ? cast value : null;\n\t}\n\n\tpublic static function string( s : Dynamic ) : String {\n\t\treturn untyped js.Boot.__string_rec(s,\"\");\n\t}\n\n\tpublic static inline function int( x : Float ) : Int {\n\t\treturn (cast x) | 0;\n\t}\n\n\tpublic static function parseInt( x : String ) : Null {\n\t\tvar v = untyped __js__(\"parseInt\")(x, 10);\n\t\t// parse again if hexadecimal\n\t\tif( v == 0 && (x.charCodeAt(1) == 'x'.code || x.charCodeAt(1) == 'X'.code) )\n\t\t\tv = untyped __js__(\"parseInt\")(x);\n\t\tif( untyped __js__(\"isNaN\")(v) )\n\t\t\treturn null;\n\t\treturn cast v;\n\t}\n\n\tpublic static inline function parseFloat( x : String ) : Float {\n\t\treturn untyped __js__(\"parseFloat\")(x);\n\t}\n\n\tpublic static function random( x : Int ) : Int {\n\t\treturn untyped x <= 0 ? 0 : Math.floor(Math.random()*x);\n\t}\n\n\tstatic function __init__() : Void untyped {\n\t\t__feature__(\"js.Boot.getClass\",String.prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"String\"] = String,String));\n\t\t__feature__(\"js.Boot.isClass\",String.__name__ = __feature__(\"Type.getClassName\",[\"String\"],true));\n\t\t__feature__(\"Type.resolveClass\",$hxClasses[\"Array\"] = Array);\n\t\t__feature__(\"js.Boot.isClass\",Array.__name__ = __feature__(\"Type.getClassName\",[\"Array\"],true));\n\t\t__feature__(\"Date.*\", {\n\t\t\t__feature__(\"js.Boot.getClass\",__js__('Date').prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"Date\"] = __js__('Date'),__js__('Date')));\n\t\t\t__feature__(\"js.Boot.isClass\",__js__('Date').__name__ = [\"Date\"]);\n\t\t});\n\t\t__feature__(\"Int.*\",{\n\t\t\tvar Int = __feature__(\"Type.resolveClass\", $hxClasses[\"Int\"] = { __name__ : [\"Int\"] }, { __name__ : [\"Int\"] });\n\t\t});\n\t\t__feature__(\"Dynamic.*\",{\n\t\t\tvar Dynamic = __feature__(\"Type.resolveClass\", $hxClasses[\"Dynamic\"] = { __name__ : [\"Dynamic\"] }, { __name__ : [\"Dynamic\"] });\n\t\t});\n\t\t__feature__(\"Float.*\",{\n\t\t\tvar Float = __feature__(\"Type.resolveClass\", $hxClasses[\"Float\"] = __js__(\"Number\"), __js__(\"Number\"));\n\t\t\tFloat.__name__ = [\"Float\"];\n\t\t});\n\t\t__feature__(\"Bool.*\",{\n\t\t\tvar Bool = __feature__(\"Type.resolveEnum\",$hxClasses[\"Bool\"] = __js__(\"Boolean\"), __js__(\"Boolean\"));\n\t\t\tBool.__ename__ = [\"Bool\"];\n\t\t});\n\t\t__feature__(\"Class.*\",{\n\t\t\tvar Class = __feature__(\"Type.resolveClass\", $hxClasses[\"Class\"] = { __name__ : [\"Class\"] }, { __name__ : [\"Class\"] });\n\t\t});\n\t\t__feature__(\"Enum.*\",{\n\t\t\tvar Enum = {};\n\t\t});\n\t\t__feature__(\"Void.*\",{\n\t\t\tvar Void = __feature__(\"Type.resolveEnum\", $hxClasses[\"Void\"] = { __ename__ : [\"Void\"] }, { __ename__ : [\"Void\"] });\n\t\t});\n\n#if !js_es5\n\t\t__feature__(\"Array.map\",\n\t\t\tif( Array.prototype.map == null )\n\t\t\t\tArray.prototype.map = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length )\n\t\t\t\t\t\ta[i] = f(__this__[i]);\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n\t\t__feature__(\"Array.filter\",\n\t\t\tif( Array.prototype.filter == null )\n\t\t\t\tArray.prototype.filter = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length ) {\n\t\t\t\t\t\tvar e = __this__[i];\n\t\t\t\t\t\tif( f(e) ) a.push(e);\n\t\t\t\t\t}\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n#end\n\t}\n\n}\n"],
"names":[],
-"mappings":";;;;;;;OAyBO,SAAgD;CACtD,EAAM,FAAU,AAAU;CAC1B,EAAS,IAAe,NAAG;;;;OAGrB,KAAoC;EAC1C,AAAI,DAAW,EAAc;EAC7B,CAAM,FAAO;EACb,CAAM;EACN,KAAO,AAAC,HAAO;;;;mBCyBT;;;CACN,EAAW;CACX,CAAI,DAAc,AAAU,GAAa,HAAM,EAAa,FAAc,AAAU;CACpF,EAAY,AAAC,CAAY,AAAQ,AAAc,AAAQ,DAA6B;CAEpF,EAAO;CACP,EAAU;CAEV;;;;;;;;;;;;;CACA;CACA;CACA,CAAI,DAAW;CAEf,CAAI,EAAwC,HAAM,EAAM,GACnD,JAAY,EAA6C,HAAM,EAAc,GAC7E,JAAY,EAAgD,HAAM,EAAc,GAChF,JAAY,EAA4C,HAAM,EAAc;CAEjF,CAAI,EAAuC,HAAM,EAAM,GAClD,JAAY,EAA4C,HAAM,EAAc,GAC5E,JAAY,EAA+C,HAAM,EAAc,GAC/E,JAAY,EAA2C,HAAM,EAAc;CAEhF,CAAI,EAAO,HAAM,EAAO,FAAmB,AAAgB,AAAK,AAAC;;;;OAyBlE,OAA0B;EACd;;EACX;EAEA,AAAI,EAAQ,AAAQ,DAAO,AAAY,FAAsB;GAC5D,AAAY,FAAW,EAAO;GAC9B,AAAe,AAAS;GAExB,AAAa,FAAW,AAAC,EAAS,AAAQ,FAAC,EAAO;GAClD,DAAI,CAAa,CAAK,DAAM,FAAY;IACvC;IACA,AAAa;IACb,DAAS,AAAU,FAAS,AAAS;IACrC,DAAU,FAAS,AAAS;IAC5B,DAAS,FAAW,EAA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,DAAC,AAAU,MAAO,UAA+B;EAElC;EAGnB,AAAI,EAAY,HAAoB,MAAO,NAAQ;EAElC,eAA+B;EACjC;EACD;EAGd,GAAO,JACP;GACC,DAAI,CAAW,FACf;IACC,DAAgB,FAAgB;IAChC,GAAO;;GAGR,AAAW,AAAgB,cAA+B;GAC1D,AAAU;;EAIX,CAAgB,cAA+B;EAC/C,KAAO;;WAUD,QACP;EACC,AAAI,DAAC,GAAY,AAAY,HAAM,MAAO;EAE1C,AAAI,DAAuB,AAAe,AAAW,MAAO;EAG3C,eAA+B;EACjC;EACD;EAEd,GAAO,JACP;GACC,DAAI,DAAuB,AAAuB,AAClD;IAEC,DAAgB;IAChB,GAAO;;GAGR,AAAW,AAAgB,cAA+B;GAC1D,AAAU;;EAIX,KAAO;;MA4BD,aACP;EACC,AAAI,DAAC,AAAU,MAAO;EAEd;EACR,GAAO,JACP;GACC,DAAI,DAAuB,AAAiB,AAAW,MAAO;GAC9D,AAAI;;EAGL,KAAO;;;;;ACjMuB,GAAkB,AAA2C;AAE7D,GAAiB,AAA0C;AAG1D,GAA0B,FAAC;AAMzD,GAAc,AAAqF,QAAa,VAAC;ALuE1G;AIrHoB,GAAM,cAA+B,hBAAM;4BZrB3B;mBAEN;kBAED;uBACK;uBACA;iBAEN;kBACC;mBACC;mBACA;kBACD;mBACC;oBACC;kBAOZ;;;;"
}
\ No newline at end of file
diff --git a/samples/_output/basics.js.map b/samples/_output/basics.js.map
index 59fcb38c..424f4a05 100644
--- a/samples/_output/basics.js.map
+++ b/samples/_output/basics.js.map
@@ -3,7 +3,7 @@
"file":"basics.js",
"sourceRoot":"file:///",
"sources":["/projects/pixi-haxe/samples/basics/Main.hx"],
-"sourcesContent":["package basics;\n\nimport pixi.core.Application;\nimport pixi.core.graphics.Graphics;\nimport pixi.core.display.Container;\nimport pixi.core.textures.Texture;\nimport pixi.core.renderers.SystemRenderer;\nimport pixi.core.renderers.Detector;\nimport pixi.core.sprites.Sprite;\nimport js.Browser;\n\nclass Main {\n\n\tvar _bunny:Sprite;\n\tvar _container:Container;\n\tvar _app:Application;\n\tvar _graphic:Graphics;\n\n\tpublic function new() {\n\t\t// Rendering options usage sample\n\t\tvar options:RenderingOptions = {};\n\t\toptions.backgroundColor = 0x006666;\n\t\toptions.resolution = 1;\n\t\toptions.transparent = true;\n\t\toptions.antialias = false;\n\n\t\t_app = new Application(800, 600, options);\n\t\t_container = new Container();\n\t\t_app.stage.addChild(_container);\n\n\t\t_bunny = new Sprite(Texture.fromImage(\"assets/basics/bunny.png\"));\n\t\t_bunny.anchor.set(0.5);\n\t\t_bunny.position.set(400, 300);\n\n\t\t_container.addChild(_bunny);\n\n\t\t_graphic = new Graphics();\n\t\t_graphic.beginFill(0xFF0000, 0.4);\n\t\t_graphic.drawRect(200, 150, 400, 300);\n\t\t_graphic.endFill();\n\n\t\t_graphic.interactive = true;\n\t\t_graphic.on(\"click\", function(evt) {trace(evt);});\n\n\t\t_container.addChild(_graphic);\n\n\t\tBrowser.document.body.appendChild(_app.view);\n\t\t_app.ticker.add(_animate);\n\t}\n\n\tfunction _animate() {\n\t\t_bunny.rotation += 0.1;\n\t}\n\n\tstatic function main() {\n\t\tnew Main();\n\t}\n}"],
+"sourcesContent":["package basics;\n\nimport pixi.core.RenderOptions;\nimport pixi.core.Application;\nimport pixi.core.graphics.Graphics;\nimport pixi.core.display.Container;\nimport pixi.core.textures.Texture;\nimport pixi.core.sprites.Sprite;\nimport js.Browser;\n\nclass Main {\n\n\tvar _bunny:Sprite;\n\tvar _container:Container;\n\tvar _app:Application;\n\tvar _graphic:Graphics;\n\n\tpublic function new() {\n\t\t// Rendering options usage sample\n\t\tvar options:RenderOptions = {};\n\t\toptions.backgroundColor = 0x006666;\n\t\toptions.resolution = 1;\n\t\toptions.transparent = true;\n\t\toptions.antialias = false;\n\n\t\t_app = new Application(800, 600, options);\n\t\t_container = new Container();\n\t\t_app.stage.addChild(_container);\n\n\t\t_bunny = new Sprite(Texture.fromImage(\"assets/basics/bunny.png\"));\n\t\t_bunny.anchor.set(0.5);\n\t\t_bunny.position.set(400, 300);\n\n\t\t_container.addChild(_bunny);\n\n\t\t_graphic = new Graphics();\n\t\t_graphic.beginFill(0xFF0000, 0.4);\n\t\t_graphic.drawRect(200, 150, 400, 300);\n\t\t_graphic.endFill();\n\n\t\t_graphic.interactive = true;\n\t\t_graphic.on(\"click\", function(evt) {trace(evt);});\n\n\t\t_container.addChild(_graphic);\n\n\t\tBrowser.document.body.appendChild(_app.view);\n\t\t_app.ticker.add(_animate);\n\t}\n\n\tfunction _animate() {\n\t\t_bunny.rotation += 0.1;\n\t}\n\n\tstatic function main() {\n\t\tnew Main();\n\t}\n}"],
"names":[],
-"mappings":";cAkBO,HAAe;CAEU;CAC/B,EAA0B;CAC1B,EAAqB;CACrB,EAAsB;CACtB,EAAoB;CAEpB,EAAO,cAAgB,hBAAK,AAAK;CACjC,EAAa;CACb,AAAoB;CAEpB,EAAS,SAAW,XAAkB;CACtC,AAAkB;CAClB,AAAoB,AAAK;CAEzB,AAAoB;CAEpB,EAAW;CACX,AAAmB,AAAU;CAC7B,AAAkB,AAAK,AAAK,AAAK;CACjC;CAEA,EAAuB;CACvB,AAAY,AAAS,aAAe;YAAM;;CAE1C,AAAoB;CAEpB,AAAkC;CAClC,AAAgB;;mBAOV,RACN;;;;UALD,CACC;IAAmB;;;;;;;;"
+"mappings":";cAiBO,HAAe;CAEO;CAC5B,EAA0B;CAC1B,EAAqB;CACrB,EAAsB;CACtB,EAAoB;CAEpB,EAAO,cAAgB,hBAAK,AAAK;CACjC,EAAa;CACb,AAAoB;CAEpB,EAAS,SAAW,XAAkB;CACtC,AAAkB;CAClB,AAAoB,AAAK;CAEzB,AAAoB;CAEpB,EAAW;CACX,AAAmB,AAAU;CAC7B,AAAkB,AAAK,AAAK,AAAK;CACjC;CAEA,EAAuB;CACvB,AAAY,AAAS,aAAe;YAAM;;CAE1C,AAAoB;CAEpB,AAAkC;CAClC,AAAgB;;mBAOV,RACN;;;;UALD,CACC;IAAmB;;;;;;;;"
}
\ No newline at end of file
diff --git a/samples/_output/bitmapfont.js b/samples/_output/bitmapfont.js
index 9747e4c5..c44bb551 100644
--- a/samples/_output/bitmapfont.js
+++ b/samples/_output/bitmapfont.js
@@ -150,7 +150,6 @@ Reflect.callMethod = function(o,func,args) {
var pixi_plugins_app_Application = function() {
this._animationFrameId = null;
this.pixelRatio = 1;
- this.set_skipFrame(false);
this.autoResize = true;
this.transparent = false;
this.antialias = false;
@@ -162,21 +161,9 @@ var pixi_plugins_app_Application = function() {
this.width = window.innerWidth;
this.height = window.innerHeight;
this.position = "static";
- this.set_fps(60);
};
pixi_plugins_app_Application.prototype = {
- set_fps: function(val) {
- this._frameCount = 0;
- return val >= 1 && val < 60?this.fps = val | 0:this.fps = 60;
- }
- ,set_skipFrame: function(val) {
- if(val) {
- console.log("pixi.plugins.app.Application > Deprecated: skipFrame - use fps property and set it to 30 instead");
- this.set_fps(30);
- }
- return this.skipFrame = val;
- }
- ,start: function(rendererType,parentDom,canvasElement) {
+ start: function(rendererType,parentDom,canvasElement) {
if(rendererType == null) rendererType = "auto";
if(canvasElement == null) {
var _this = window.document;
@@ -185,8 +172,7 @@ pixi_plugins_app_Application.prototype = {
this.canvas.style.height = this.height + "px";
this.canvas.style.position = this.position;
} else this.canvas = canvasElement;
- if(parentDom == null) window.document.body.appendChild(this.canvas); else parentDom.appendChild(this.canvas);
- this.stage = new PIXI.Container();
+ if(this.autoResize) window.onresize = $bind(this,this._onWindowResize);
var renderingOptions = { };
renderingOptions.view = this.canvas;
renderingOptions.backgroundColor = this.backgroundColor;
@@ -197,35 +183,33 @@ pixi_plugins_app_Application.prototype = {
renderingOptions.transparent = this.transparent;
renderingOptions.clearBeforeRender = this.clearBeforeRender;
renderingOptions.preserveDrawingBuffer = this.preserveDrawingBuffer;
- if(rendererType == "auto") this.renderer = PIXI.autoDetectRenderer(this.width,this.height,renderingOptions); else if(rendererType == "canvas") this.renderer = new PIXI.CanvasRenderer(this.width,this.height,renderingOptions); else this.renderer = new PIXI.WebGLRenderer(this.width,this.height,renderingOptions);
- if(this.roundPixels) this.renderer.roundPixels = true;
- if(parentDom == null) window.document.body.appendChild(this.renderer.view); else parentDom.appendChild(this.renderer.view);
- this.resumeRendering();
+ renderingOptions.roundPixels = this.roundPixels;
+ if(rendererType != null) switch(rendererType) {
+ case "canvas":
+ this.app = new PIXI.Application(this.width,this.height,renderingOptions,true);
+ break;
+ default:
+ this.app = new PIXI.Application(this.width,this.height,renderingOptions);
+ } else this.app = new PIXI.Application(this.width,this.height,renderingOptions);
+ this.stage = this.app.stage;
+ this.renderer = this.app.renderer;
+ if(parentDom == null) window.document.body.appendChild(this.app.view); else parentDom.appendChild(this.app.view);
+ this.app.ticker.add($bind(this,this._onRequestAnimationFrame));
this.addStats();
}
- ,resumeRendering: function() {
- if(this.autoResize) window.onresize = $bind(this,this._onWindowResize);
- if(this._animationFrameId == null) this._animationFrameId = window.requestAnimationFrame($bind(this,this._onRequestAnimationFrame));
- }
,_onWindowResize: function(event) {
this.width = window.innerWidth;
this.height = window.innerHeight;
- this.renderer.resize(this.width,this.height);
+ this.app.renderer.resize(this.width,this.height);
this.canvas.style.width = this.width + "px";
this.canvas.style.height = this.height + "px";
if(this.onResize != null) this.onResize();
}
- ,_onRequestAnimationFrame: function(elapsedTime) {
- this._frameCount++;
- if(this._frameCount == (60 / this.fps | 0)) {
- this._frameCount = 0;
- if(this.onUpdate != null) this.onUpdate(elapsedTime);
- this.renderer.render(this.stage);
- }
- this._animationFrameId = window.requestAnimationFrame($bind(this,this._onRequestAnimationFrame));
+ ,_onRequestAnimationFrame: function() {
+ if(this.onUpdate != null) this.onUpdate(this.app.ticker.deltaTime);
}
,addStats: function() {
- if(window.Perf != null) new Perf().addInfo(["UNKNOWN","WEBGL","CANVAS"][this.renderer.type] + " - " + this.pixelRatio);
+ if(window.Perf != null) new Perf().addInfo(["UNKNOWN","WEBGL","CANVAS"][this.app.renderer.type] + " - " + this.pixelRatio);
}
};
var bitmapfont_Main = function() {
@@ -239,6 +223,7 @@ bitmapfont_Main.__super__ = pixi_plugins_app_Application;
bitmapfont_Main.prototype = $extend(pixi_plugins_app_Application.prototype,{
_init: function() {
this.position = "fixed";
+ this.autoResize = true;
this.backgroundColor = 13158;
pixi_plugins_app_Application.prototype.start.call(this);
var fontloader = new PIXI.loaders.Loader();
diff --git a/samples/_output/bitmapfont.js.map b/samples/_output/bitmapfont.js.map
index 186a27a5..2a67dc79 100644
--- a/samples/_output/bitmapfont.js.map
+++ b/samples/_output/bitmapfont.js.map
@@ -3,7 +3,7 @@
"file":"bitmapfont.js",
"sourceRoot":"file:///",
"sources":["/projects/pixi-haxe/.haxelib/perf,js/1,1,8/src/Perf.hx","/usr/local/lib/haxe/std/js/_std/Reflect.hx","/projects/pixi-haxe/src/pixi/plugins/app/Application.hx","/projects/pixi-haxe/samples/bitmapfont/Main.hx"],
-"sourcesContent":["import js.html.Performance;\nimport js.html.DivElement;\nimport js.Browser;\n\n@:expose class Perf {\n\n\tpublic static var MEASUREMENT_INTERVAL:Int = 1000;\n\n\tpublic static var FONT_FAMILY:String = \"Helvetica,Arial\";\n\n\tpublic static var FPS_BG_CLR:String = \"#00FF00\";\n\tpublic static var FPS_WARN_BG_CLR:String = \"#FF8000\";\n\tpublic static var FPS_PROB_BG_CLR:String = \"#FF0000\";\n\n\tpublic static var MS_BG_CLR:String = \"#FFFF00\";\n\tpublic static var MEM_BG_CLR:String = \"#086A87\";\n\tpublic static var INFO_BG_CLR:String = \"#00FFFF\";\n\tpublic static var FPS_TXT_CLR:String = \"#000000\";\n\tpublic static var MS_TXT_CLR:String = \"#000000\";\n\tpublic static var MEM_TXT_CLR:String = \"#FFFFFF\";\n\tpublic static var INFO_TXT_CLR:String = \"#000000\";\n\n\tpublic static var TOP_LEFT:String = \"TL\";\n\tpublic static var TOP_RIGHT:String = \"TR\";\n\tpublic static var BOTTOM_LEFT:String = \"BL\";\n\tpublic static var BOTTOM_RIGHT:String = \"BR\";\n\n\tstatic var DELAY_TIME:Int = 4000;\n\n\tpublic var fps:DivElement;\n\tpublic var ms:DivElement;\n\tpublic var memory:DivElement;\n\tpublic var info:DivElement;\n\n\tpublic var lowFps:Float;\n\tpublic var avgFps:Float;\n\tpublic var currentFps:Float;\n\tpublic var currentMs:Float;\n\tpublic var currentMem:String;\n\n\tvar _time:Float;\n\tvar _startTime:Float;\n\tvar _prevTime:Float;\n\tvar _ticks:Int;\n\tvar _fpsMin:Float;\n\tvar _fpsMax:Float;\n\tvar _memCheck:Bool;\n\tvar _pos:String;\n\tvar _offset:Float;\n\tvar _measureCount:Int;\n\tvar _totalFps:Float;\n\n\tvar _perfObj:Performance;\n\tvar _memoryObj:Memory;\n\tvar _raf:Int;\n\n\tvar RAF:Dynamic;\n\tvar CAF:Dynamic;\n\n\tpublic function new(?pos = \"TR\", ?offset:Float = 0) {\n\t\t_perfObj = Browser.window.performance;\n\t\tif (Reflect.field(_perfObj, \"memory\") != null) _memoryObj = Reflect.field(_perfObj, \"memory\");\n\t\t_memCheck = (_perfObj != null && _memoryObj != null && _memoryObj.totalJSHeapSize > 0);\n\n\t\t_pos = pos;\n\t\t_offset = offset;\n\n\t\t_init();\n\t\t_createFpsDom();\n\t\t_createMsDom();\n\t\tif (_memCheck) _createMemoryDom();\n\n\t\tif (Browser.window.requestAnimationFrame != null) RAF = Browser.window.requestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozRequestAnimationFrame != null) RAF = untyped __js__(\"window\").mozRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitRequestAnimationFrame != null) RAF = untyped __js__(\"window\").webkitRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msRequestAnimationFrame != null) RAF = untyped __js__(\"window\").msRequestAnimationFrame;\n\n\t\tif (Browser.window.cancelAnimationFrame != null) CAF = Browser.window.cancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozCancelAnimationFrame != null) CAF = untyped __js__(\"window\").mozCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitCancelAnimationFrame != null) CAF = untyped __js__(\"window\").webkitCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msCancelAnimationFrame != null) CAF = untyped __js__(\"window\").msCancelAnimationFrame;\n\n\t\tif (RAF != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tinline function _init() {\n\t\tcurrentFps = 60;\n\t\tcurrentMs = 0;\n\t\tcurrentMem = \"0\";\n\n\t\tlowFps = 60;\n\t\tavgFps = 60;\n\n\t\t_measureCount = 0;\n\t\t_totalFps = 0;\n\t\t_time = 0;\n\t\t_ticks = 0;\n\t\t_fpsMin = 60;\n\t\t_fpsMax = 60;\n\t\t_startTime = _now();\n\t\t_prevTime = -MEASUREMENT_INTERVAL;\n\t}\n\n\tinline function _now():Float {\n\t\treturn (_perfObj != null && _perfObj.now != null) ? _perfObj.now() : Date.now().getTime();\n\t}\n\n\tfunction _tick(val:Float) {\n\t\tvar time = _now();\n\t\t_ticks++;\n\n\t\tif (_raf != null && time > _prevTime + MEASUREMENT_INTERVAL) {\n\t\t\tcurrentMs = Math.round(time - _startTime);\n\t\t\tms.innerHTML = \"MS: \" + currentMs;\n\n\t\t\tcurrentFps = Math.round((_ticks * 1000) / (time - _prevTime));\n\t\t\tif (currentFps > 0 && val > DELAY_TIME) {\n\t\t\t\t_measureCount++;\n\t\t\t\t_totalFps += currentFps;\n\t\t\t\tlowFps = _fpsMin = Math.min(_fpsMin, currentFps);\n\t\t\t\t_fpsMax = Math.max(_fpsMax, currentFps);\n\t\t\t\tavgFps = Math.round(_totalFps / _measureCount);\n\t\t\t}\n\n\t\t\tfps.innerHTML = \"FPS: \" + currentFps + \" (\" + _fpsMin + \"-\" + _fpsMax + \")\";\n\n\t\t\tif (currentFps >= 30) fps.style.backgroundColor = FPS_BG_CLR;\n\t\t\telse if (currentFps >= 15) fps.style.backgroundColor = FPS_WARN_BG_CLR;\n\t\t\telse fps.style.backgroundColor = FPS_PROB_BG_CLR;\n\n\t\t\t_prevTime = time;\n\t\t\t_ticks = 0;\n\n\t\t\tif (_memCheck) {\n\t\t\t\tcurrentMem = _getFormattedSize(_memoryObj.usedJSHeapSize, 2);\n\t\t\t\tmemory.innerHTML = \"MEM: \" + currentMem;\n\t\t\t}\n\t\t}\n\t\t_startTime = time;\n\n\t\tif (_raf != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tfunction _createDiv(id:String, ?top:Float = 0):DivElement {\n\t\tvar div:DivElement = Browser.document.createDivElement();\n\t\tdiv.id = id;\n\t\tdiv.className = id;\n\t\tdiv.style.position = \"absolute\";\n\n\t\tswitch (_pos) {\n\t\t\tcase \"TL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"TR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"BL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t\tcase \"BR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t}\n\n\t\tdiv.style.width = \"80px\";\n\t\tdiv.style.height = \"12px\";\n\t\tdiv.style.lineHeight = \"12px\";\n\t\tdiv.style.padding = \"2px\";\n\t\tdiv.style.fontFamily = FONT_FAMILY;\n\t\tdiv.style.fontSize = \"9px\";\n\t\tdiv.style.fontWeight = \"bold\";\n\t\tdiv.style.textAlign = \"center\";\n\t\tBrowser.document.body.appendChild(div);\n\t\treturn div;\n\t}\n\n\tfunction _createFpsDom() {\n\t\tfps = _createDiv(\"fps\");\n\t\tfps.style.backgroundColor = FPS_BG_CLR;\n\t\tfps.style.zIndex = \"995\";\n\t\tfps.style.color = FPS_TXT_CLR;\n\t\tfps.innerHTML = \"FPS: 0\";\n\t}\n\n\tfunction _createMsDom() {\n\t\tms = _createDiv(\"ms\", 16);\n\t\tms.style.backgroundColor = MS_BG_CLR;\n\t\tms.style.zIndex = \"996\";\n\t\tms.style.color = MS_TXT_CLR;\n\t\tms.innerHTML = \"MS: 0\";\n\t}\n\n\tfunction _createMemoryDom() {\n\t\tmemory = _createDiv(\"memory\", 32);\n\t\tmemory.style.backgroundColor = MEM_BG_CLR;\n\t\tmemory.style.color = MEM_TXT_CLR;\n\t\tmemory.style.zIndex = \"997\";\n\t\tmemory.innerHTML = \"MEM: 0\";\n\t}\n\n\tfunction _getFormattedSize(bytes:Float, ?frac:Int = 0):String {\n\t\tvar sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n\t\tif (bytes == 0) return \"0\";\n\t\tvar precision = Math.pow(10, frac);\n\t\tvar i = Math.floor(Math.log(bytes) / Math.log(1024));\n\t\treturn Math.round(bytes * precision / Math.pow(1024, i)) / precision + \" \" + sizes[i];\n\t}\n\n\tpublic function addInfo(val:String) {\n\t\tinfo = _createDiv(\"info\", (_memCheck) ? 48 : 32);\n\t\tinfo.style.backgroundColor = INFO_BG_CLR;\n\t\tinfo.style.color = INFO_TXT_CLR;\n\t\tinfo.style.zIndex = \"998\";\n\t\tinfo.innerHTML = val;\n\t}\n\n\tpublic function clearInfo() {\n\t\tif (info != null) {\n\t\t\tBrowser.document.body.removeChild(info);\n\t\t\tinfo = null;\n\t\t}\n\t}\n\n\tpublic function destroy() {\n\t\t_cancelRAF();\n\t\t_perfObj = null;\n\t\t_memoryObj = null;\n\t\tif (fps != null) {\n\t\t\tBrowser.document.body.removeChild(fps);\n\t\t\tfps = null;\n\t\t}\n\t\tif (ms != null) {\n\t\t\tBrowser.document.body.removeChild(ms);\n\t\t\tms = null;\n\t\t}\n\t\tif (memory != null) {\n\t\t\tBrowser.document.body.removeChild(memory);\n\t\t\tmemory = null;\n\t\t}\n\t\tclearInfo();\n\t\t_init();\n\t}\n\n\tinline function _cancelRAF() {\n\t\tReflect.callMethod(Browser.window, CAF, [_raf]);\n\t\t_raf = null;\n\t}\n}\n\ntypedef Memory = {\n\tvar usedJSHeapSize:Float;\n\tvar totalJSHeapSize:Float;\n\tvar jsHeapSizeLimit:Float;\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class Reflect {\n\n\tpublic inline static function hasField( o : Dynamic, field : String ) : Bool {\n\t\treturn untyped __js__('Object').prototype.hasOwnProperty.call(o, field);\n\t}\n\n\tpublic static function field( o : Dynamic, field : String ) : Dynamic {\n\t\ttry return untyped o[field] catch( e : Dynamic ) return null;\n\t}\n\n\tpublic inline static function setField( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\to[field] = value;\n\t}\n\n\tpublic static inline function getProperty( o : Dynamic, field : String ) : Dynamic untyped {\n\t\tvar tmp;\n\t\treturn if( o == null ) __define_feature__(\"Reflect.getProperty\",null) else if( o.__properties__ && (tmp=o.__properties__[\"get_\"+field]) ) o[tmp]() else o[field];\n\t}\n\n\tpublic static inline function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\tvar tmp;\n\t\tif( o.__properties__ && (tmp=o.__properties__[\"set_\"+field]) ) o[tmp](value) else o[field] = __define_feature__(\"Reflect.setProperty\",value);\n\t}\n\n\tpublic inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array ) : Dynamic untyped {\n\t\treturn func.apply(o,args);\n\t}\n\n\tpublic static function fields( o : Dynamic ) : Array {\n\t\tvar a = [];\n\t\tif (o != null) untyped {\n\t\t\tvar hasOwnProperty = __js__('Object').prototype.hasOwnProperty;\n\t\t\t__js__(\"for( var f in o ) {\");\n\t\t\tif( f != \"__id__\" && f != \"hx__closures__\" && hasOwnProperty.call(o, f) ) a.push(f);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static function isFunction( f : Dynamic ) : Bool untyped {\n\t\treturn __js__(\"typeof(f)\") == \"function\" && !(js.Boot.isClass(f) || js.Boot.isEnum(f));\n\t}\n\n\tpublic static function compare( a : T, b : T ) : Int {\n\t\treturn ( a == b ) ? 0 : (((cast a) > (cast b)) ? 1 : -1);\n\t}\n\n\tpublic static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool {\n\t\tif( f1 == f2 )\n\t\t\treturn true;\n\t\tif( !isFunction(f1) || !isFunction(f2) )\n\t\t\treturn false;\n\t\treturn f1.scope == f2.scope && f1.method == f2.method && f1.method != null;\n\t}\n\n\tpublic static function isObject( v : Dynamic ) : Bool untyped {\n\t\tif( v == null )\n\t\t\treturn false;\n\t\tvar t = __js__(\"typeof(v)\");\n\t\treturn (t == \"string\" || (t == \"object\" && v.__enum__ == null)) || (t == \"function\" && (js.Boot.isClass(v) || js.Boot.isEnum(v)) != null);\n\t}\n\n\tpublic static function isEnumValue( v : Dynamic ) : Bool {\n\t\treturn v != null && v.__enum__ != null;\n\t}\n\n\tpublic static function deleteField( o : Dynamic, field : String ) : Bool untyped {\n\t\tif( !hasField(o,field) ) return false;\n\t\t__js__(\"delete\")(o[field]);\n\t\treturn true;\n\t}\n\n\tpublic static function copy( o : T ) : T {\n\t\tvar o2 : Dynamic = {};\n\t\tfor( f in Reflect.fields(o) )\n\t\t\tReflect.setField(o2,f,Reflect.field(o,f));\n\t\treturn o2;\n\t}\n\n\t@:overload(function( f : Array -> Void ) : Dynamic {})\n\tpublic static function makeVarArgs( f : Array -> Dynamic ) : Dynamic {\n\t\treturn function() {\n\t\t\tvar a = untyped Array.prototype.slice.call(__js__(\"arguments\"));\n\t\t\treturn f(a);\n\t\t};\n\t}\n\n}\n","package pixi.plugins.app;\n\nimport pixi.core.renderers.webgl.WebGLRenderer;\nimport pixi.core.renderers.canvas.CanvasRenderer;\nimport pixi.core.renderers.Detector;\nimport pixi.core.display.Container;\nimport js.html.Event;\nimport js.html.Element;\nimport js.html.CanvasElement;\nimport js.Browser;\n\n/**\n * Pixi Boilerplate Helper class that can be used by any application\n * @author Adi Reddy Mora\n * http://adireddy.github.io\n * @license MIT\n * @copyright 2015\n */\nclass Application {\n\n\t/**\n * Sets the pixel ratio of the application.\n * default - 1\n */\n\tpublic var pixelRatio:Float;\n\n\t/**\n\t * Default frame rate is 60 FPS and this can be set to true to get 30 FPS.\n\t * default - false\n\t */\n\tpublic var skipFrame(default, set):Bool;\n\n\t/**\n\t * Default frame rate is 60 FPS and this can be set to anything between 1 - 60.\n\t * default - 60\n\t */\n\tpublic var fps(default, set):Int;\n\n\t/**\n\t * Width of the application.\n\t * default - Browser.window.innerWidth\n\t */\n\tpublic var width:Float;\n\n\t/**\n\t * Height of the application.\n\t * default - Browser.window.innerHeight\n\t */\n\tpublic var height:Float;\n\n\t/**\n\t * Position of canvas element\n\t * default - static\n\t */\n\tpublic var position:String;\n\n\t/**\n\t * Renderer transparency property.\n\t * default - false\n\t */\n\tpublic var transparent:Bool;\n\n\t/**\n\t * Graphics antialias property.\n\t * default - false\n\t */\n\tpublic var antialias:Bool;\n\n\t/**\n\t * Force FXAA shader antialias instead of native (faster).\n\t * default - false\n\t */\n\tpublic var forceFXAA:Bool;\n\n\t/**\n\t * Force round pixels.\n\t * default - false\n\t */\n\tpublic var roundPixels:Bool;\n\n\t/**\n\t * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.\n * If the scene is transparent Pixi will use clearRect to clear the canvas every frame.\n * Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.\n\t * default - true\n\t */\n\tpublic var clearBeforeRender:Bool;\n\n\t/**\n\t * enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context\n\t * default - false\n\t */\n\tpublic var preserveDrawingBuffer:Bool;\n\n\t/**\n\t * Whether you want to resize the canvas and renderer on browser resize.\n\t * Should be set to false when custom width and height are used for the application.\n\t * default - true\n\t */\n\tpublic var autoResize:Bool;\n\n\t/**\n\t * Sets the background color of the stage.\n\t * default - 0xFFFFFF\n\t */\n\tpublic var backgroundColor:Int;\n\n\t/**\n\t * Update listener \tfunction\n\t */\n\tpublic var onUpdate:Float -> Void;\n\n\t/**\n\t * Window resize listener \tfunction\n\t */\n\tpublic var onResize:Void -> Void;\n\n\t/**\n\t * Canvas Element\n\t * Read-only\n\t */\n\tpublic var canvas(default, null):CanvasElement;\n\n\t/**\n\t * Renderer\n\t * Read-only\n\t */\n\tpublic var renderer(default, null):Dynamic;\n\n\t/**\n\t * Global Container.\n\t * Read-only\n\t */\n\tpublic var stage(default, null):Container;\n\n\tpublic static inline var AUTO:String = \"auto\";\n\tpublic static inline var RECOMMENDED:String = \"recommended\";\n\tpublic static inline var CANVAS:String = \"canvas\";\n\tpublic static inline var WEBGL:String = \"webgl\";\n\n\tvar _frameCount:Int;\n\tvar _animationFrameId:Null;\n\n\tpublic function new() {\n\t\t_setDefaultValues();\n\t}\n\n\tfunction set_fps(val:Int):Int {\n\t\t_frameCount = 0;\n\t\treturn fps = (val >= 1 && val < 60) ? Std.int(val) : 60;\n\t}\n\n\tfunction set_skipFrame(val:Bool):Bool {\n\t\tif (val) {\n\t\t\ttrace(\"pixi.plugins.app.Application > Deprecated: skipFrame - use fps property and set it to 30 instead\");\n\t\t\tfps = 30;\n\t\t}\n\t\treturn skipFrame = val;\n\t}\n\n\tinline function _setDefaultValues() {\n\t\t_animationFrameId = null;\n\t\tpixelRatio = 1;\n\t\tskipFrame = false;\n\t\tautoResize = true;\n\t\ttransparent = false;\n\t\tantialias = false;\n\t\tforceFXAA = false;\n\t\troundPixels = false;\n\t\tclearBeforeRender = true;\n\t\tpreserveDrawingBuffer = false;\n\t\tbackgroundColor = 0xFFFFFF;\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tposition = \"static\";\n\t\tfps = 60;\n\t}\n\n\t/**\n\t * Starts pixi application setup using the properties set or default values\n\t * @param [rendererType] - Renderer type to use AUTO (default) | CANVAS | WEBGL\n\t * @param [stats] - Enable/disable stats for the application.\n\t * Note that stats.js is not part of pixi so don't forget to include it you html page\n\t * Can be found in libs folder. \"libs/stats.min.js\" \n\t * @param [parentDom] - By default canvas will be appended to body or it can be appended to custom element if passed\n\t */\n\n\tpublic function start(?rendererType:String = \"auto\", ?parentDom:Element, ?canvasElement:CanvasElement) {\n\t\tif (canvasElement == null) {\n\t\t\tcanvas = Browser.document.createCanvasElement();\n\t\t\tcanvas.style.width = width + \"px\";\n\t\t\tcanvas.style.height = height + \"px\";\n\t\t\tcanvas.style.position = position;\n\t\t}\n\t\telse canvas = canvasElement;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(canvas);\n\t\telse parentDom.appendChild(canvas);\n\n\t\tstage = new Container();\n\n\t\tvar renderingOptions:RenderingOptions = {};\n\t\trenderingOptions.view = canvas;\n\t\trenderingOptions.backgroundColor = backgroundColor;\n\t\trenderingOptions.resolution = pixelRatio;\n\t\trenderingOptions.antialias = antialias;\n\t\trenderingOptions.forceFXAA = forceFXAA;\n\t\trenderingOptions.autoResize = autoResize;\n\t\trenderingOptions.transparent = transparent;\n\t\trenderingOptions.clearBeforeRender = clearBeforeRender;\n\t\trenderingOptions.preserveDrawingBuffer = preserveDrawingBuffer;\n\n\t\tif (rendererType == AUTO) renderer = Detector.autoDetectRenderer(width, height, renderingOptions);\n\t\telse if (rendererType == CANVAS) renderer = new CanvasRenderer(width, height, renderingOptions);\n\t\telse renderer = new WebGLRenderer(width, height, renderingOptions);\n\n\t\tif (roundPixels) renderer.roundPixels = true;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(renderer.view);\n\t\telse parentDom.appendChild(renderer.view);\n\t\tresumeRendering();\n\t\t#if stats addStats(); #end\n\t}\n\n\tpublic function pauseRendering() {\n\t\tBrowser.window.onresize = null;\n\t\tif (_animationFrameId != null) {\n\t\t\tBrowser.window.cancelAnimationFrame(_animationFrameId);\n\t\t\t_animationFrameId = null;\n\t\t}\n\t}\n\n\tpublic function resumeRendering() {\n\t\tif (autoResize) Browser.window.onresize = _onWindowResize;\n\t\tif (_animationFrameId == null) _animationFrameId = Browser.window.requestAnimationFrame(_onRequestAnimationFrame);\n\t}\n\n\t@:noCompletion function _onWindowResize(event:Event) {\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\trenderer.resize(width, height);\n\t\tcanvas.style.width = width + \"px\";\n\t\tcanvas.style.height = height + \"px\";\n\n\t\tif (onResize != null) onResize();\n\t}\n\n\t@:noCompletion function _onRequestAnimationFrame(elapsedTime:Float) {\n\t\t_frameCount++;\n\t\tif (_frameCount == Std.int(60 / fps)) {\n\t\t\t_frameCount = 0;\n\t\t\tif (onUpdate != null) onUpdate(elapsedTime);\n\t\t\trenderer.render(stage);\n\t\t}\n\t\t_animationFrameId = Browser.window.requestAnimationFrame(_onRequestAnimationFrame);\n\t}\n\n\tpublic function addStats() {\n\t\tif (untyped __js__(\"window\").Perf != null) {\n\t\t\tnew Perf().addInfo([\"UNKNOWN\", \"WEBGL\", \"CANVAS\"][renderer.type] + \" - \" + pixelRatio);\n\t\t}\n\t}\n}","package bitmapfont;\n\nimport pixi.loaders.Loader;\nimport pixi.extras.BitmapText;\nimport pixi.plugins.app.Application;\nimport js.Browser;\n\nclass Main extends Application {\n\n\tpublic function new() {\n\t\tsuper();\n\t\t_init();\n\t}\n\n\tfunction _init() {\n\t\tposition = \"fixed\";\n\t\tbackgroundColor = 0x003366;\n\t\tsuper.start();\n\n\t\tvar fontloader:Loader = new Loader();\n\t\tfontloader.add(\"font\", \"./assets/fonts/desyrel.xml\");\n\t\tfontloader.load(_onLoaded);\n\t}\n\n\tfunction _onLoaded() {\n\t\tvar bitmapFontText = new BitmapText(\"bitmap fonts are\\n now supported!\", {font: \"60px Desyrel\"});\n\t\tbitmapFontText.position.x = (Browser.window.innerWidth - bitmapFontText.width) / 2;\n\t\tbitmapFontText.position.y = (Browser.window.innerHeight - bitmapFontText.height) / 2;\n\t\tstage.addChild(bitmapFontText);\n\t}\n\n\tstatic function main() {\n\t\tnew Main();\n\t}\n}"],
+"sourcesContent":["import js.html.Performance;\nimport js.html.DivElement;\nimport js.Browser;\n\n@:expose class Perf {\n\n\tpublic static var MEASUREMENT_INTERVAL:Int = 1000;\n\n\tpublic static var FONT_FAMILY:String = \"Helvetica,Arial\";\n\n\tpublic static var FPS_BG_CLR:String = \"#00FF00\";\n\tpublic static var FPS_WARN_BG_CLR:String = \"#FF8000\";\n\tpublic static var FPS_PROB_BG_CLR:String = \"#FF0000\";\n\n\tpublic static var MS_BG_CLR:String = \"#FFFF00\";\n\tpublic static var MEM_BG_CLR:String = \"#086A87\";\n\tpublic static var INFO_BG_CLR:String = \"#00FFFF\";\n\tpublic static var FPS_TXT_CLR:String = \"#000000\";\n\tpublic static var MS_TXT_CLR:String = \"#000000\";\n\tpublic static var MEM_TXT_CLR:String = \"#FFFFFF\";\n\tpublic static var INFO_TXT_CLR:String = \"#000000\";\n\n\tpublic static var TOP_LEFT:String = \"TL\";\n\tpublic static var TOP_RIGHT:String = \"TR\";\n\tpublic static var BOTTOM_LEFT:String = \"BL\";\n\tpublic static var BOTTOM_RIGHT:String = \"BR\";\n\n\tstatic var DELAY_TIME:Int = 4000;\n\n\tpublic var fps:DivElement;\n\tpublic var ms:DivElement;\n\tpublic var memory:DivElement;\n\tpublic var info:DivElement;\n\n\tpublic var lowFps:Float;\n\tpublic var avgFps:Float;\n\tpublic var currentFps:Float;\n\tpublic var currentMs:Float;\n\tpublic var currentMem:String;\n\n\tvar _time:Float;\n\tvar _startTime:Float;\n\tvar _prevTime:Float;\n\tvar _ticks:Int;\n\tvar _fpsMin:Float;\n\tvar _fpsMax:Float;\n\tvar _memCheck:Bool;\n\tvar _pos:String;\n\tvar _offset:Float;\n\tvar _measureCount:Int;\n\tvar _totalFps:Float;\n\n\tvar _perfObj:Performance;\n\tvar _memoryObj:Memory;\n\tvar _raf:Int;\n\n\tvar RAF:Dynamic;\n\tvar CAF:Dynamic;\n\n\tpublic function new(?pos = \"TR\", ?offset:Float = 0) {\n\t\t_perfObj = Browser.window.performance;\n\t\tif (Reflect.field(_perfObj, \"memory\") != null) _memoryObj = Reflect.field(_perfObj, \"memory\");\n\t\t_memCheck = (_perfObj != null && _memoryObj != null && _memoryObj.totalJSHeapSize > 0);\n\n\t\t_pos = pos;\n\t\t_offset = offset;\n\n\t\t_init();\n\t\t_createFpsDom();\n\t\t_createMsDom();\n\t\tif (_memCheck) _createMemoryDom();\n\n\t\tif (Browser.window.requestAnimationFrame != null) RAF = Browser.window.requestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozRequestAnimationFrame != null) RAF = untyped __js__(\"window\").mozRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitRequestAnimationFrame != null) RAF = untyped __js__(\"window\").webkitRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msRequestAnimationFrame != null) RAF = untyped __js__(\"window\").msRequestAnimationFrame;\n\n\t\tif (Browser.window.cancelAnimationFrame != null) CAF = Browser.window.cancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozCancelAnimationFrame != null) CAF = untyped __js__(\"window\").mozCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitCancelAnimationFrame != null) CAF = untyped __js__(\"window\").webkitCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msCancelAnimationFrame != null) CAF = untyped __js__(\"window\").msCancelAnimationFrame;\n\n\t\tif (RAF != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tinline function _init() {\n\t\tcurrentFps = 60;\n\t\tcurrentMs = 0;\n\t\tcurrentMem = \"0\";\n\n\t\tlowFps = 60;\n\t\tavgFps = 60;\n\n\t\t_measureCount = 0;\n\t\t_totalFps = 0;\n\t\t_time = 0;\n\t\t_ticks = 0;\n\t\t_fpsMin = 60;\n\t\t_fpsMax = 60;\n\t\t_startTime = _now();\n\t\t_prevTime = -MEASUREMENT_INTERVAL;\n\t}\n\n\tinline function _now():Float {\n\t\treturn (_perfObj != null && _perfObj.now != null) ? _perfObj.now() : Date.now().getTime();\n\t}\n\n\tfunction _tick(val:Float) {\n\t\tvar time = _now();\n\t\t_ticks++;\n\n\t\tif (_raf != null && time > _prevTime + MEASUREMENT_INTERVAL) {\n\t\t\tcurrentMs = Math.round(time - _startTime);\n\t\t\tms.innerHTML = \"MS: \" + currentMs;\n\n\t\t\tcurrentFps = Math.round((_ticks * 1000) / (time - _prevTime));\n\t\t\tif (currentFps > 0 && val > DELAY_TIME) {\n\t\t\t\t_measureCount++;\n\t\t\t\t_totalFps += currentFps;\n\t\t\t\tlowFps = _fpsMin = Math.min(_fpsMin, currentFps);\n\t\t\t\t_fpsMax = Math.max(_fpsMax, currentFps);\n\t\t\t\tavgFps = Math.round(_totalFps / _measureCount);\n\t\t\t}\n\n\t\t\tfps.innerHTML = \"FPS: \" + currentFps + \" (\" + _fpsMin + \"-\" + _fpsMax + \")\";\n\n\t\t\tif (currentFps >= 30) fps.style.backgroundColor = FPS_BG_CLR;\n\t\t\telse if (currentFps >= 15) fps.style.backgroundColor = FPS_WARN_BG_CLR;\n\t\t\telse fps.style.backgroundColor = FPS_PROB_BG_CLR;\n\n\t\t\t_prevTime = time;\n\t\t\t_ticks = 0;\n\n\t\t\tif (_memCheck) {\n\t\t\t\tcurrentMem = _getFormattedSize(_memoryObj.usedJSHeapSize, 2);\n\t\t\t\tmemory.innerHTML = \"MEM: \" + currentMem;\n\t\t\t}\n\t\t}\n\t\t_startTime = time;\n\n\t\tif (_raf != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tfunction _createDiv(id:String, ?top:Float = 0):DivElement {\n\t\tvar div:DivElement = Browser.document.createDivElement();\n\t\tdiv.id = id;\n\t\tdiv.className = id;\n\t\tdiv.style.position = \"absolute\";\n\n\t\tswitch (_pos) {\n\t\t\tcase \"TL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"TR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"BL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t\tcase \"BR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t}\n\n\t\tdiv.style.width = \"80px\";\n\t\tdiv.style.height = \"12px\";\n\t\tdiv.style.lineHeight = \"12px\";\n\t\tdiv.style.padding = \"2px\";\n\t\tdiv.style.fontFamily = FONT_FAMILY;\n\t\tdiv.style.fontSize = \"9px\";\n\t\tdiv.style.fontWeight = \"bold\";\n\t\tdiv.style.textAlign = \"center\";\n\t\tBrowser.document.body.appendChild(div);\n\t\treturn div;\n\t}\n\n\tfunction _createFpsDom() {\n\t\tfps = _createDiv(\"fps\");\n\t\tfps.style.backgroundColor = FPS_BG_CLR;\n\t\tfps.style.zIndex = \"995\";\n\t\tfps.style.color = FPS_TXT_CLR;\n\t\tfps.innerHTML = \"FPS: 0\";\n\t}\n\n\tfunction _createMsDom() {\n\t\tms = _createDiv(\"ms\", 16);\n\t\tms.style.backgroundColor = MS_BG_CLR;\n\t\tms.style.zIndex = \"996\";\n\t\tms.style.color = MS_TXT_CLR;\n\t\tms.innerHTML = \"MS: 0\";\n\t}\n\n\tfunction _createMemoryDom() {\n\t\tmemory = _createDiv(\"memory\", 32);\n\t\tmemory.style.backgroundColor = MEM_BG_CLR;\n\t\tmemory.style.color = MEM_TXT_CLR;\n\t\tmemory.style.zIndex = \"997\";\n\t\tmemory.innerHTML = \"MEM: 0\";\n\t}\n\n\tfunction _getFormattedSize(bytes:Float, ?frac:Int = 0):String {\n\t\tvar sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n\t\tif (bytes == 0) return \"0\";\n\t\tvar precision = Math.pow(10, frac);\n\t\tvar i = Math.floor(Math.log(bytes) / Math.log(1024));\n\t\treturn Math.round(bytes * precision / Math.pow(1024, i)) / precision + \" \" + sizes[i];\n\t}\n\n\tpublic function addInfo(val:String) {\n\t\tinfo = _createDiv(\"info\", (_memCheck) ? 48 : 32);\n\t\tinfo.style.backgroundColor = INFO_BG_CLR;\n\t\tinfo.style.color = INFO_TXT_CLR;\n\t\tinfo.style.zIndex = \"998\";\n\t\tinfo.innerHTML = val;\n\t}\n\n\tpublic function clearInfo() {\n\t\tif (info != null) {\n\t\t\tBrowser.document.body.removeChild(info);\n\t\t\tinfo = null;\n\t\t}\n\t}\n\n\tpublic function destroy() {\n\t\t_cancelRAF();\n\t\t_perfObj = null;\n\t\t_memoryObj = null;\n\t\tif (fps != null) {\n\t\t\tBrowser.document.body.removeChild(fps);\n\t\t\tfps = null;\n\t\t}\n\t\tif (ms != null) {\n\t\t\tBrowser.document.body.removeChild(ms);\n\t\t\tms = null;\n\t\t}\n\t\tif (memory != null) {\n\t\t\tBrowser.document.body.removeChild(memory);\n\t\t\tmemory = null;\n\t\t}\n\t\tclearInfo();\n\t\t_init();\n\t}\n\n\tinline function _cancelRAF() {\n\t\tReflect.callMethod(Browser.window, CAF, [_raf]);\n\t\t_raf = null;\n\t}\n}\n\ntypedef Memory = {\n\tvar usedJSHeapSize:Float;\n\tvar totalJSHeapSize:Float;\n\tvar jsHeapSizeLimit:Float;\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class Reflect {\n\n\tpublic inline static function hasField( o : Dynamic, field : String ) : Bool {\n\t\treturn untyped __js__('Object').prototype.hasOwnProperty.call(o, field);\n\t}\n\n\tpublic static function field( o : Dynamic, field : String ) : Dynamic {\n\t\ttry return untyped o[field] catch( e : Dynamic ) return null;\n\t}\n\n\tpublic inline static function setField( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\to[field] = value;\n\t}\n\n\tpublic static inline function getProperty( o : Dynamic, field : String ) : Dynamic untyped {\n\t\tvar tmp;\n\t\treturn if( o == null ) __define_feature__(\"Reflect.getProperty\",null) else if( o.__properties__ && (tmp=o.__properties__[\"get_\"+field]) ) o[tmp]() else o[field];\n\t}\n\n\tpublic static inline function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\tvar tmp;\n\t\tif( o.__properties__ && (tmp=o.__properties__[\"set_\"+field]) ) o[tmp](value) else o[field] = __define_feature__(\"Reflect.setProperty\",value);\n\t}\n\n\tpublic inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array ) : Dynamic untyped {\n\t\treturn func.apply(o,args);\n\t}\n\n\tpublic static function fields( o : Dynamic ) : Array {\n\t\tvar a = [];\n\t\tif (o != null) untyped {\n\t\t\tvar hasOwnProperty = __js__('Object').prototype.hasOwnProperty;\n\t\t\t__js__(\"for( var f in o ) {\");\n\t\t\tif( f != \"__id__\" && f != \"hx__closures__\" && hasOwnProperty.call(o, f) ) a.push(f);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static function isFunction( f : Dynamic ) : Bool untyped {\n\t\treturn __js__(\"typeof(f)\") == \"function\" && !(js.Boot.isClass(f) || js.Boot.isEnum(f));\n\t}\n\n\tpublic static function compare( a : T, b : T ) : Int {\n\t\treturn ( a == b ) ? 0 : (((cast a) > (cast b)) ? 1 : -1);\n\t}\n\n\tpublic static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool {\n\t\tif( f1 == f2 )\n\t\t\treturn true;\n\t\tif( !isFunction(f1) || !isFunction(f2) )\n\t\t\treturn false;\n\t\treturn f1.scope == f2.scope && f1.method == f2.method && f1.method != null;\n\t}\n\n\tpublic static function isObject( v : Dynamic ) : Bool untyped {\n\t\tif( v == null )\n\t\t\treturn false;\n\t\tvar t = __js__(\"typeof(v)\");\n\t\treturn (t == \"string\" || (t == \"object\" && v.__enum__ == null)) || (t == \"function\" && (js.Boot.isClass(v) || js.Boot.isEnum(v)) != null);\n\t}\n\n\tpublic static function isEnumValue( v : Dynamic ) : Bool {\n\t\treturn v != null && v.__enum__ != null;\n\t}\n\n\tpublic static function deleteField( o : Dynamic, field : String ) : Bool untyped {\n\t\tif( !hasField(o,field) ) return false;\n\t\t__js__(\"delete\")(o[field]);\n\t\treturn true;\n\t}\n\n\tpublic static function copy( o : T ) : T {\n\t\tvar o2 : Dynamic = {};\n\t\tfor( f in Reflect.fields(o) )\n\t\t\tReflect.setField(o2,f,Reflect.field(o,f));\n\t\treturn o2;\n\t}\n\n\t@:overload(function( f : Array -> Void ) : Dynamic {})\n\tpublic static function makeVarArgs( f : Array -> Dynamic ) : Dynamic {\n\t\treturn function() {\n\t\t\tvar a = untyped Array.prototype.slice.call(__js__(\"arguments\"));\n\t\t\treturn f(a);\n\t\t};\n\t}\n\n}\n","package pixi.plugins.app;\n\nimport pixi.core.renderers.SystemRenderer;\nimport js.html.Event;\nimport pixi.core.RenderOptions;\nimport pixi.core.display.Container;\nimport js.html.Element;\nimport js.html.CanvasElement;\nimport js.Browser;\n\n/**\n * Pixi Boilerplate Helper class that can be used by any application\n * @author Adi Reddy Mora\n * http://adireddy.github.io\n * @license MIT\n * @copyright 2015\n */\nclass Application {\n\n\t/**\n * Sets the pixel ratio of the application.\n * default - 1\n */\n\tpublic var pixelRatio:Float;\n\n\t/**\n\t * Width of the application.\n\t * default - Browser.window.innerWidth\n\t */\n\tpublic var width:Float;\n\n\t/**\n\t * Height of the application.\n\t * default - Browser.window.innerHeight\n\t */\n\tpublic var height:Float;\n\n\t/**\n\t * Position of canvas element\n\t * default - static\n\t */\n\tpublic var position:String;\n\n\t/**\n\t * Renderer transparency property.\n\t * default - false\n\t */\n\tpublic var transparent:Bool;\n\n\t/**\n\t * Graphics antialias property.\n\t * default - false\n\t */\n\tpublic var antialias:Bool;\n\n\t/**\n\t * Force FXAA shader antialias instead of native (faster).\n\t * default - false\n\t */\n\tpublic var forceFXAA:Bool;\n\n\t/**\n\t * Force round pixels.\n\t * default - false\n\t */\n\tpublic var roundPixels:Bool;\n\n\t/**\n\t * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.\n * If the scene is transparent Pixi will use clearRect to clear the canvas every frame.\n * Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.\n\t * default - true\n\t */\n\tpublic var clearBeforeRender:Bool;\n\n\t/**\n\t * enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context\n\t * default - false\n\t */\n\tpublic var preserveDrawingBuffer:Bool;\n\n\t/**\n\t * Whether you want to resize the canvas and renderer on browser resize.\n\t * Should be set to false when custom width and height are used for the application.\n\t * default - true\n\t */\n\tpublic var autoResize:Bool;\n\n\t/**\n\t * Sets the background color of the stage.\n\t * default - 0xFFFFFF\n\t */\n\tpublic var backgroundColor:Int;\n\n\t/**\n\t * Update listener \tfunction\n\t */\n\tpublic var onUpdate:Float -> Void;\n\n\t/**\n\t * Window resize listener \tfunction\n\t */\n\tpublic var onResize:Void -> Void;\n\n\t/**\n\t * Canvas Element\n\t * Read-only\n\t */\n\tpublic var canvas(default, null):CanvasElement;\n\n\t/**\n\t * Renderer\n\t * Read-only\n\t */\n\tpublic var renderer(default, null):SystemRenderer;\n\n\t/**\n\t * Global Container.\n\t * Read-only\n\t */\n\tpublic var stage(default, null):Container;\n\n\t/**\n\t * Pixi Application\n\t * Read-only\n\t */\n\tpublic var app(default, null):pixi.core.Application;\n\n\tpublic static inline var AUTO:String = \"auto\";\n\tpublic static inline var RECOMMENDED:String = \"recommended\";\n\tpublic static inline var CANVAS:String = \"canvas\";\n\tpublic static inline var WEBGL:String = \"webgl\";\n\n\tpublic static inline var POSITION_STATIC:String = \"static\";\n\tpublic static inline var POSITION_ABSOLUTE:String = \"absolute\";\n\tpublic static inline var POSITION_FIXED:String = \"fixed\";\n\tpublic static inline var POSITION_RELATIVE:String = \"relative\";\n\tpublic static inline var POSITION_INITIAL:String = \"initial\";\n\tpublic static inline var POSITION_INHERIT:String = \"inherit\";\n\n\tvar _frameCount:Int;\n\tvar _animationFrameId:Null;\n\n\tpublic function new() {\n\t\t_setDefaultValues();\n\t}\n\n\tinline function _setDefaultValues() {\n\t\t_animationFrameId = null;\n\t\tpixelRatio = 1;\n\t\tautoResize = true;\n\t\ttransparent = false;\n\t\tantialias = false;\n\t\tforceFXAA = false;\n\t\troundPixels = false;\n\t\tclearBeforeRender = true;\n\t\tpreserveDrawingBuffer = false;\n\t\tbackgroundColor = 0xFFFFFF;\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tposition = \"static\";\n\t}\n\n\t/**\n\t * Starts pixi application setup using the properties set or default values\n\t * @param [rendererType] - Renderer type to use AUTO (default) | CANVAS | WEBGL\n\t * @param [stats] - Enable/disable stats for the application.\n\t * Note that stats.js is not part of pixi so don't forget to include it you html page\n\t * Can be found in libs folder. \"libs/stats.min.js\" \n\t * @param [parentDom] - By default canvas will be appended to body or it can be appended to custom element if passed\n\t */\n\n\tpublic function start(?rendererType:String = \"auto\", ?parentDom:Element, ?canvasElement:CanvasElement) {\n\t\tif (canvasElement == null) {\n\t\t\tcanvas = Browser.document.createCanvasElement();\n\t\t\tcanvas.style.width = width + \"px\";\n\t\t\tcanvas.style.height = height + \"px\";\n\t\t\tcanvas.style.position = position;\n\t\t}\n\t\telse canvas = canvasElement;\n\n\t\tif (autoResize) Browser.window.onresize = _onWindowResize;\n\n\t\tvar renderingOptions:RenderOptions = {};\n\t\trenderingOptions.view = canvas;\n\t\trenderingOptions.backgroundColor = backgroundColor;\n\t\trenderingOptions.resolution = pixelRatio;\n\t\trenderingOptions.antialias = antialias;\n\t\trenderingOptions.forceFXAA = forceFXAA;\n\t\trenderingOptions.autoResize = autoResize;\n\t\trenderingOptions.transparent = transparent;\n\t\trenderingOptions.clearBeforeRender = clearBeforeRender;\n\t\trenderingOptions.preserveDrawingBuffer = preserveDrawingBuffer;\n\t\trenderingOptions.roundPixels = roundPixels;\n\n\t\tswitch (rendererType) {\n\t\t\tcase CANVAS: app = new pixi.core.Application(width, height, renderingOptions, true);\n\t\t\tdefault: app = new pixi.core.Application(width, height, renderingOptions);\n\t\t}\n\n\t\tstage = app.stage;\n\t\trenderer = app.renderer;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(app.view);\n\t\telse parentDom.appendChild(app.view);\n\n\t\tapp.ticker.add(_onRequestAnimationFrame);\n\n\t\t#if stats addStats(); #end\n\t}\n\n\tpublic function pauseRendering() {\n\t\tapp.stop();\n\t}\n\n\tpublic function resumeRendering() {\n\t\tapp.start();\n\t}\n\n\t@:noCompletion function _onWindowResize(event:Event) {\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tapp.renderer.resize(width, height);\n\t\tcanvas.style.width = width + \"px\";\n\t\tcanvas.style.height = height + \"px\";\n\n\t\tif (onResize != null) onResize();\n\t}\n\n\t@:noCompletion function _onRequestAnimationFrame() {\n\t\tif (onUpdate != null) onUpdate(app.ticker.deltaTime);\n\t}\n\n\tpublic function addStats() {\n\t\tif (untyped __js__(\"window\").Perf != null) {\n\t\t\tnew Perf().addInfo([\"UNKNOWN\", \"WEBGL\", \"CANVAS\"][app.renderer.type] + \" - \" + pixelRatio);\n\t\t}\n\t}\n}","package bitmapfont;\n\nimport pixi.loaders.Loader;\nimport pixi.extras.BitmapText;\nimport pixi.plugins.app.Application;\nimport js.Browser;\n\nclass Main extends Application {\n\n\tpublic function new() {\n\t\tsuper();\n\t\t_init();\n\t}\n\n\tfunction _init() {\n\t\tposition = Application.POSITION_FIXED;\n\t\tautoResize = true;\n\t\tbackgroundColor = 0x003366;\n\t\tsuper.start();\n\n\t\tvar fontloader:Loader = new Loader();\n\t\tfontloader.add(\"font\", \"./assets/fonts/desyrel.xml\");\n\t\tfontloader.load(_onLoaded);\n\t}\n\n\tfunction _onLoaded() {\n\t\tvar bitmapFontText = new BitmapText(\"bitmap fonts are\\n now supported!\", {font: \"60px Desyrel\"});\n\t\tbitmapFontText.position.x = (Browser.window.innerWidth - bitmapFontText.width) / 2;\n\t\tbitmapFontText.position.y = (Browser.window.innerHeight - bitmapFontText.height) / 2;\n\t\tstage.addChild(bitmapFontText);\n\t}\n\n\tstatic function main() {\n\t\tnew Main();\n\t}\n}"],
"names":[],
-"mappings":";;;;;;;mBA2DO;;;CACN,EAAW;CACX,CAAI,DAAc,AAAU,GAAa,HAAM,EAAa,FAAc,AAAU;CACpF,EAAY,AAAC,CAAY,AAAQ,AAAc,AAAQ,DAA6B;CAEpF,EAAO;CACP,EAAU;CAEV;;;;;;;;;;;;;CACA;CACA;CACA,CAAI,DAAW;CAEf,CAAI,EAAwC,HAAM,EAAM,GACnD,JAAY,EAA6C,HAAM,EAAc,GAC7E,JAAY,EAAgD,HAAM,EAAc,GAChF,JAAY,EAA4C,HAAM,EAAc;CAEjF,CAAI,EAAuC,HAAM,EAAM,GAClD,JAAY,EAA4C,HAAM,EAAc,GAC5E,JAAY,EAA+C,HAAM,EAAc,GAC/E,JAAY,EAA2C,HAAM,EAAc;CAEhF,CAAI,EAAO,HAAM,EAAO,FAAmB,AAAgB,AAAK,AAAC;;;OAyBlE,OAA0B;EACd;;EACX;EAEA,AAAI,EAAQ,AAAQ,DAAO,AAAY,FAAsB;GAC5D,AAAY,FAAW,EAAO;GAC9B,AAAe,AAAS;GAExB,AAAa,FAAW,AAAC,EAAS,AAAQ,FAAC,EAAO;GAClD,DAAI,CAAa,CAAK,DAAM,FAAY;IACvC;IACA,AAAa;IACb,DAAS,AAAU,FAAS,AAAS;IACrC,DAAU,FAAS,AAAS;IAC5B,DAAS,FAAW,EAAY;;GAGjC,AAAiB,AAAU,AAAa,AAAO,AAAU,AAAM,AAAU;GAEzE,DAAI,EAAc,HAAI,EAA4B,GAC7C,JAAI,EAAc,HAAI,EAA4B,GAClD,HAA4B;GAEjC,AAAY;GACZ,AAAS;GAET,DAAI,DAAW;IACd,DAAa,FAAkB,AAA2B;IAC1D,DAAmB,AAAU;;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_output/blur.js
index 79e56917..bad0eeb8 100644
--- a/samples/_output/blur.js
+++ b/samples/_output/blur.js
@@ -150,7 +150,6 @@ Reflect.callMethod = function(o,func,args) {
var pixi_plugins_app_Application = function() {
this._animationFrameId = null;
this.pixelRatio = 1;
- this.set_skipFrame(false);
this.autoResize = true;
this.transparent = false;
this.antialias = false;
@@ -162,21 +161,9 @@ var pixi_plugins_app_Application = function() {
this.width = window.innerWidth;
this.height = window.innerHeight;
this.position = "static";
- this.set_fps(60);
};
pixi_plugins_app_Application.prototype = {
- set_fps: function(val) {
- this._frameCount = 0;
- return val >= 1 && val < 60?this.fps = val | 0:this.fps = 60;
- }
- ,set_skipFrame: function(val) {
- if(val) {
- console.log("pixi.plugins.app.Application > Deprecated: skipFrame - use fps property and set it to 30 instead");
- this.set_fps(30);
- }
- return this.skipFrame = val;
- }
- ,start: function(rendererType,parentDom,canvasElement) {
+ start: function(rendererType,parentDom,canvasElement) {
if(rendererType == null) rendererType = "auto";
if(canvasElement == null) {
var _this = window.document;
@@ -185,8 +172,7 @@ pixi_plugins_app_Application.prototype = {
this.canvas.style.height = this.height + "px";
this.canvas.style.position = this.position;
} else this.canvas = canvasElement;
- if(parentDom == null) window.document.body.appendChild(this.canvas); else parentDom.appendChild(this.canvas);
- this.stage = new PIXI.Container();
+ if(this.autoResize) window.onresize = $bind(this,this._onWindowResize);
var renderingOptions = { };
renderingOptions.view = this.canvas;
renderingOptions.backgroundColor = this.backgroundColor;
@@ -197,35 +183,33 @@ pixi_plugins_app_Application.prototype = {
renderingOptions.transparent = this.transparent;
renderingOptions.clearBeforeRender = this.clearBeforeRender;
renderingOptions.preserveDrawingBuffer = this.preserveDrawingBuffer;
- if(rendererType == "auto") this.renderer = PIXI.autoDetectRenderer(this.width,this.height,renderingOptions); else if(rendererType == "canvas") this.renderer = new PIXI.CanvasRenderer(this.width,this.height,renderingOptions); else this.renderer = new PIXI.WebGLRenderer(this.width,this.height,renderingOptions);
- if(this.roundPixels) this.renderer.roundPixels = true;
- if(parentDom == null) window.document.body.appendChild(this.renderer.view); else parentDom.appendChild(this.renderer.view);
- this.resumeRendering();
+ renderingOptions.roundPixels = this.roundPixels;
+ if(rendererType != null) switch(rendererType) {
+ case "canvas":
+ this.app = new PIXI.Application(this.width,this.height,renderingOptions,true);
+ break;
+ default:
+ this.app = new PIXI.Application(this.width,this.height,renderingOptions);
+ } else this.app = new PIXI.Application(this.width,this.height,renderingOptions);
+ this.stage = this.app.stage;
+ this.renderer = this.app.renderer;
+ if(parentDom == null) window.document.body.appendChild(this.app.view); else parentDom.appendChild(this.app.view);
+ this.app.ticker.add($bind(this,this._onRequestAnimationFrame));
this.addStats();
}
- ,resumeRendering: function() {
- if(this.autoResize) window.onresize = $bind(this,this._onWindowResize);
- if(this._animationFrameId == null) this._animationFrameId = window.requestAnimationFrame($bind(this,this._onRequestAnimationFrame));
- }
,_onWindowResize: function(event) {
this.width = window.innerWidth;
this.height = window.innerHeight;
- this.renderer.resize(this.width,this.height);
+ this.app.renderer.resize(this.width,this.height);
this.canvas.style.width = this.width + "px";
this.canvas.style.height = this.height + "px";
if(this.onResize != null) this.onResize();
}
- ,_onRequestAnimationFrame: function(elapsedTime) {
- this._frameCount++;
- if(this._frameCount == (60 / this.fps | 0)) {
- this._frameCount = 0;
- if(this.onUpdate != null) this.onUpdate(elapsedTime);
- this.renderer.render(this.stage);
- }
- this._animationFrameId = window.requestAnimationFrame($bind(this,this._onRequestAnimationFrame));
+ ,_onRequestAnimationFrame: function() {
+ if(this.onUpdate != null) this.onUpdate(this.app.ticker.deltaTime);
}
,addStats: function() {
- if(window.Perf != null) new Perf().addInfo(["UNKNOWN","WEBGL","CANVAS"][this.renderer.type] + " - " + this.pixelRatio);
+ if(window.Perf != null) new Perf().addInfo(["UNKNOWN","WEBGL","CANVAS"][this.app.renderer.type] + " - " + this.pixelRatio);
}
};
var filters_blur_Main = function() {
diff --git a/samples/_output/blur.js.map b/samples/_output/blur.js.map
index 2f09cc70..f619e6ed 100644
--- a/samples/_output/blur.js.map
+++ b/samples/_output/blur.js.map
@@ -3,7 +3,7 @@
"file":"blur.js",
"sourceRoot":"file:///",
"sources":["/projects/pixi-haxe/.haxelib/perf,js/1,1,8/src/Perf.hx","/usr/local/lib/haxe/std/js/_std/Reflect.hx","/projects/pixi-haxe/src/pixi/plugins/app/Application.hx","/projects/pixi-haxe/samples/filters/blur/Main.hx"],
-"sourcesContent":["import js.html.Performance;\nimport js.html.DivElement;\nimport js.Browser;\n\n@:expose class Perf {\n\n\tpublic static var MEASUREMENT_INTERVAL:Int = 1000;\n\n\tpublic static var FONT_FAMILY:String = \"Helvetica,Arial\";\n\n\tpublic static var FPS_BG_CLR:String = \"#00FF00\";\n\tpublic static var FPS_WARN_BG_CLR:String = \"#FF8000\";\n\tpublic static var FPS_PROB_BG_CLR:String = \"#FF0000\";\n\n\tpublic static var MS_BG_CLR:String = \"#FFFF00\";\n\tpublic static var MEM_BG_CLR:String = \"#086A87\";\n\tpublic static var INFO_BG_CLR:String = \"#00FFFF\";\n\tpublic static var FPS_TXT_CLR:String = \"#000000\";\n\tpublic static var MS_TXT_CLR:String = \"#000000\";\n\tpublic static var MEM_TXT_CLR:String = \"#FFFFFF\";\n\tpublic static var INFO_TXT_CLR:String = \"#000000\";\n\n\tpublic static var TOP_LEFT:String = \"TL\";\n\tpublic static var TOP_RIGHT:String = \"TR\";\n\tpublic static var BOTTOM_LEFT:String = \"BL\";\n\tpublic static var BOTTOM_RIGHT:String = \"BR\";\n\n\tstatic var DELAY_TIME:Int = 4000;\n\n\tpublic var fps:DivElement;\n\tpublic var ms:DivElement;\n\tpublic var memory:DivElement;\n\tpublic var info:DivElement;\n\n\tpublic var lowFps:Float;\n\tpublic var avgFps:Float;\n\tpublic var currentFps:Float;\n\tpublic var currentMs:Float;\n\tpublic var currentMem:String;\n\n\tvar _time:Float;\n\tvar _startTime:Float;\n\tvar _prevTime:Float;\n\tvar _ticks:Int;\n\tvar _fpsMin:Float;\n\tvar _fpsMax:Float;\n\tvar _memCheck:Bool;\n\tvar _pos:String;\n\tvar _offset:Float;\n\tvar _measureCount:Int;\n\tvar _totalFps:Float;\n\n\tvar _perfObj:Performance;\n\tvar _memoryObj:Memory;\n\tvar _raf:Int;\n\n\tvar RAF:Dynamic;\n\tvar CAF:Dynamic;\n\n\tpublic function new(?pos = \"TR\", ?offset:Float = 0) {\n\t\t_perfObj = Browser.window.performance;\n\t\tif (Reflect.field(_perfObj, \"memory\") != null) _memoryObj = Reflect.field(_perfObj, \"memory\");\n\t\t_memCheck = (_perfObj != null && _memoryObj != null && _memoryObj.totalJSHeapSize > 0);\n\n\t\t_pos = pos;\n\t\t_offset = offset;\n\n\t\t_init();\n\t\t_createFpsDom();\n\t\t_createMsDom();\n\t\tif (_memCheck) _createMemoryDom();\n\n\t\tif (Browser.window.requestAnimationFrame != null) RAF = Browser.window.requestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozRequestAnimationFrame != null) RAF = untyped __js__(\"window\").mozRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitRequestAnimationFrame != null) RAF = untyped __js__(\"window\").webkitRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msRequestAnimationFrame != null) RAF = untyped __js__(\"window\").msRequestAnimationFrame;\n\n\t\tif (Browser.window.cancelAnimationFrame != null) CAF = Browser.window.cancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozCancelAnimationFrame != null) CAF = untyped __js__(\"window\").mozCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitCancelAnimationFrame != null) CAF = untyped __js__(\"window\").webkitCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msCancelAnimationFrame != null) CAF = untyped __js__(\"window\").msCancelAnimationFrame;\n\n\t\tif (RAF != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tinline function _init() {\n\t\tcurrentFps = 60;\n\t\tcurrentMs = 0;\n\t\tcurrentMem = \"0\";\n\n\t\tlowFps = 60;\n\t\tavgFps = 60;\n\n\t\t_measureCount = 0;\n\t\t_totalFps = 0;\n\t\t_time = 0;\n\t\t_ticks = 0;\n\t\t_fpsMin = 60;\n\t\t_fpsMax = 60;\n\t\t_startTime = _now();\n\t\t_prevTime = -MEASUREMENT_INTERVAL;\n\t}\n\n\tinline function _now():Float {\n\t\treturn (_perfObj != null && _perfObj.now != null) ? _perfObj.now() : Date.now().getTime();\n\t}\n\n\tfunction _tick(val:Float) {\n\t\tvar time = _now();\n\t\t_ticks++;\n\n\t\tif (_raf != null && time > _prevTime + MEASUREMENT_INTERVAL) {\n\t\t\tcurrentMs = Math.round(time - _startTime);\n\t\t\tms.innerHTML = \"MS: \" + currentMs;\n\n\t\t\tcurrentFps = Math.round((_ticks * 1000) / (time - _prevTime));\n\t\t\tif (currentFps > 0 && val > DELAY_TIME) {\n\t\t\t\t_measureCount++;\n\t\t\t\t_totalFps += currentFps;\n\t\t\t\tlowFps = _fpsMin = Math.min(_fpsMin, currentFps);\n\t\t\t\t_fpsMax = Math.max(_fpsMax, currentFps);\n\t\t\t\tavgFps = Math.round(_totalFps / _measureCount);\n\t\t\t}\n\n\t\t\tfps.innerHTML = \"FPS: \" + currentFps + \" (\" + _fpsMin + \"-\" + _fpsMax + \")\";\n\n\t\t\tif (currentFps >= 30) fps.style.backgroundColor = FPS_BG_CLR;\n\t\t\telse if (currentFps >= 15) fps.style.backgroundColor = FPS_WARN_BG_CLR;\n\t\t\telse fps.style.backgroundColor = FPS_PROB_BG_CLR;\n\n\t\t\t_prevTime = time;\n\t\t\t_ticks = 0;\n\n\t\t\tif (_memCheck) {\n\t\t\t\tcurrentMem = _getFormattedSize(_memoryObj.usedJSHeapSize, 2);\n\t\t\t\tmemory.innerHTML = \"MEM: \" + currentMem;\n\t\t\t}\n\t\t}\n\t\t_startTime = time;\n\n\t\tif (_raf != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tfunction _createDiv(id:String, ?top:Float = 0):DivElement {\n\t\tvar div:DivElement = Browser.document.createDivElement();\n\t\tdiv.id = id;\n\t\tdiv.className = id;\n\t\tdiv.style.position = \"absolute\";\n\n\t\tswitch (_pos) {\n\t\t\tcase \"TL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"TR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"BL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t\tcase \"BR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t}\n\n\t\tdiv.style.width = \"80px\";\n\t\tdiv.style.height = \"12px\";\n\t\tdiv.style.lineHeight = \"12px\";\n\t\tdiv.style.padding = \"2px\";\n\t\tdiv.style.fontFamily = FONT_FAMILY;\n\t\tdiv.style.fontSize = \"9px\";\n\t\tdiv.style.fontWeight = \"bold\";\n\t\tdiv.style.textAlign = \"center\";\n\t\tBrowser.document.body.appendChild(div);\n\t\treturn div;\n\t}\n\n\tfunction _createFpsDom() {\n\t\tfps = _createDiv(\"fps\");\n\t\tfps.style.backgroundColor = FPS_BG_CLR;\n\t\tfps.style.zIndex = \"995\";\n\t\tfps.style.color = FPS_TXT_CLR;\n\t\tfps.innerHTML = \"FPS: 0\";\n\t}\n\n\tfunction _createMsDom() {\n\t\tms = _createDiv(\"ms\", 16);\n\t\tms.style.backgroundColor = MS_BG_CLR;\n\t\tms.style.zIndex = \"996\";\n\t\tms.style.color = MS_TXT_CLR;\n\t\tms.innerHTML = \"MS: 0\";\n\t}\n\n\tfunction _createMemoryDom() {\n\t\tmemory = _createDiv(\"memory\", 32);\n\t\tmemory.style.backgroundColor = MEM_BG_CLR;\n\t\tmemory.style.color = MEM_TXT_CLR;\n\t\tmemory.style.zIndex = \"997\";\n\t\tmemory.innerHTML = \"MEM: 0\";\n\t}\n\n\tfunction _getFormattedSize(bytes:Float, ?frac:Int = 0):String {\n\t\tvar sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n\t\tif (bytes == 0) return \"0\";\n\t\tvar precision = Math.pow(10, frac);\n\t\tvar i = Math.floor(Math.log(bytes) / Math.log(1024));\n\t\treturn Math.round(bytes * precision / Math.pow(1024, i)) / precision + \" \" + sizes[i];\n\t}\n\n\tpublic function addInfo(val:String) {\n\t\tinfo = _createDiv(\"info\", (_memCheck) ? 48 : 32);\n\t\tinfo.style.backgroundColor = INFO_BG_CLR;\n\t\tinfo.style.color = INFO_TXT_CLR;\n\t\tinfo.style.zIndex = \"998\";\n\t\tinfo.innerHTML = val;\n\t}\n\n\tpublic function clearInfo() {\n\t\tif (info != null) {\n\t\t\tBrowser.document.body.removeChild(info);\n\t\t\tinfo = null;\n\t\t}\n\t}\n\n\tpublic function destroy() {\n\t\t_cancelRAF();\n\t\t_perfObj = null;\n\t\t_memoryObj = null;\n\t\tif (fps != null) {\n\t\t\tBrowser.document.body.removeChild(fps);\n\t\t\tfps = null;\n\t\t}\n\t\tif (ms != null) {\n\t\t\tBrowser.document.body.removeChild(ms);\n\t\t\tms = null;\n\t\t}\n\t\tif (memory != null) {\n\t\t\tBrowser.document.body.removeChild(memory);\n\t\t\tmemory = null;\n\t\t}\n\t\tclearInfo();\n\t\t_init();\n\t}\n\n\tinline function _cancelRAF() {\n\t\tReflect.callMethod(Browser.window, CAF, [_raf]);\n\t\t_raf = null;\n\t}\n}\n\ntypedef Memory = {\n\tvar usedJSHeapSize:Float;\n\tvar totalJSHeapSize:Float;\n\tvar jsHeapSizeLimit:Float;\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class Reflect {\n\n\tpublic inline static function hasField( o : Dynamic, field : String ) : Bool {\n\t\treturn untyped __js__('Object').prototype.hasOwnProperty.call(o, field);\n\t}\n\n\tpublic static function field( o : Dynamic, field : String ) : Dynamic {\n\t\ttry return untyped o[field] catch( e : Dynamic ) return null;\n\t}\n\n\tpublic inline static function setField( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\to[field] = value;\n\t}\n\n\tpublic static inline function getProperty( o : Dynamic, field : String ) : Dynamic untyped {\n\t\tvar tmp;\n\t\treturn if( o == null ) __define_feature__(\"Reflect.getProperty\",null) else if( o.__properties__ && (tmp=o.__properties__[\"get_\"+field]) ) o[tmp]() else o[field];\n\t}\n\n\tpublic static inline function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\tvar tmp;\n\t\tif( o.__properties__ && (tmp=o.__properties__[\"set_\"+field]) ) o[tmp](value) else o[field] = __define_feature__(\"Reflect.setProperty\",value);\n\t}\n\n\tpublic inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array ) : Dynamic untyped {\n\t\treturn func.apply(o,args);\n\t}\n\n\tpublic static function fields( o : Dynamic ) : Array {\n\t\tvar a = [];\n\t\tif (o != null) untyped {\n\t\t\tvar hasOwnProperty = __js__('Object').prototype.hasOwnProperty;\n\t\t\t__js__(\"for( var f in o ) {\");\n\t\t\tif( f != \"__id__\" && f != \"hx__closures__\" && hasOwnProperty.call(o, f) ) a.push(f);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static function isFunction( f : Dynamic ) : Bool untyped {\n\t\treturn __js__(\"typeof(f)\") == \"function\" && !(js.Boot.isClass(f) || js.Boot.isEnum(f));\n\t}\n\n\tpublic static function compare( a : T, b : T ) : Int {\n\t\treturn ( a == b ) ? 0 : (((cast a) > (cast b)) ? 1 : -1);\n\t}\n\n\tpublic static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool {\n\t\tif( f1 == f2 )\n\t\t\treturn true;\n\t\tif( !isFunction(f1) || !isFunction(f2) )\n\t\t\treturn false;\n\t\treturn f1.scope == f2.scope && f1.method == f2.method && f1.method != null;\n\t}\n\n\tpublic static function isObject( v : Dynamic ) : Bool untyped {\n\t\tif( v == null )\n\t\t\treturn false;\n\t\tvar t = __js__(\"typeof(v)\");\n\t\treturn (t == \"string\" || (t == \"object\" && v.__enum__ == null)) || (t == \"function\" && (js.Boot.isClass(v) || js.Boot.isEnum(v)) != null);\n\t}\n\n\tpublic static function isEnumValue( v : Dynamic ) : Bool {\n\t\treturn v != null && v.__enum__ != null;\n\t}\n\n\tpublic static function deleteField( o : Dynamic, field : String ) : Bool untyped {\n\t\tif( !hasField(o,field) ) return false;\n\t\t__js__(\"delete\")(o[field]);\n\t\treturn true;\n\t}\n\n\tpublic static function copy( o : T ) : T {\n\t\tvar o2 : Dynamic = {};\n\t\tfor( f in Reflect.fields(o) )\n\t\t\tReflect.setField(o2,f,Reflect.field(o,f));\n\t\treturn o2;\n\t}\n\n\t@:overload(function( f : Array -> Void ) : Dynamic {})\n\tpublic static function makeVarArgs( f : Array -> Dynamic ) : Dynamic {\n\t\treturn function() {\n\t\t\tvar a = untyped Array.prototype.slice.call(__js__(\"arguments\"));\n\t\t\treturn f(a);\n\t\t};\n\t}\n\n}\n","package pixi.plugins.app;\n\nimport pixi.core.renderers.webgl.WebGLRenderer;\nimport pixi.core.renderers.canvas.CanvasRenderer;\nimport pixi.core.renderers.Detector;\nimport pixi.core.display.Container;\nimport js.html.Event;\nimport js.html.Element;\nimport js.html.CanvasElement;\nimport js.Browser;\n\n/**\n * Pixi Boilerplate Helper class that can be used by any application\n * @author Adi Reddy Mora\n * http://adireddy.github.io\n * @license MIT\n * @copyright 2015\n */\nclass Application {\n\n\t/**\n * Sets the pixel ratio of the application.\n * default - 1\n */\n\tpublic var pixelRatio:Float;\n\n\t/**\n\t * Default frame rate is 60 FPS and this can be set to true to get 30 FPS.\n\t * default - false\n\t */\n\tpublic var skipFrame(default, set):Bool;\n\n\t/**\n\t * Default frame rate is 60 FPS and this can be set to anything between 1 - 60.\n\t * default - 60\n\t */\n\tpublic var fps(default, set):Int;\n\n\t/**\n\t * Width of the application.\n\t * default - Browser.window.innerWidth\n\t */\n\tpublic var width:Float;\n\n\t/**\n\t * Height of the application.\n\t * default - Browser.window.innerHeight\n\t */\n\tpublic var height:Float;\n\n\t/**\n\t * Position of canvas element\n\t * default - static\n\t */\n\tpublic var position:String;\n\n\t/**\n\t * Renderer transparency property.\n\t * default - false\n\t */\n\tpublic var transparent:Bool;\n\n\t/**\n\t * Graphics antialias property.\n\t * default - false\n\t */\n\tpublic var antialias:Bool;\n\n\t/**\n\t * Force FXAA shader antialias instead of native (faster).\n\t * default - false\n\t */\n\tpublic var forceFXAA:Bool;\n\n\t/**\n\t * Force round pixels.\n\t * default - false\n\t */\n\tpublic var roundPixels:Bool;\n\n\t/**\n\t * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.\n * If the scene is transparent Pixi will use clearRect to clear the canvas every frame.\n * Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.\n\t * default - true\n\t */\n\tpublic var clearBeforeRender:Bool;\n\n\t/**\n\t * enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context\n\t * default - false\n\t */\n\tpublic var preserveDrawingBuffer:Bool;\n\n\t/**\n\t * Whether you want to resize the canvas and renderer on browser resize.\n\t * Should be set to false when custom width and height are used for the application.\n\t * default - true\n\t */\n\tpublic var autoResize:Bool;\n\n\t/**\n\t * Sets the background color of the stage.\n\t * default - 0xFFFFFF\n\t */\n\tpublic var backgroundColor:Int;\n\n\t/**\n\t * Update listener \tfunction\n\t */\n\tpublic var onUpdate:Float -> Void;\n\n\t/**\n\t * Window resize listener \tfunction\n\t */\n\tpublic var onResize:Void -> Void;\n\n\t/**\n\t * Canvas Element\n\t * Read-only\n\t */\n\tpublic var canvas(default, null):CanvasElement;\n\n\t/**\n\t * Renderer\n\t * Read-only\n\t */\n\tpublic var renderer(default, null):Dynamic;\n\n\t/**\n\t * Global Container.\n\t * Read-only\n\t */\n\tpublic var stage(default, null):Container;\n\n\tpublic static inline var AUTO:String = \"auto\";\n\tpublic static inline var RECOMMENDED:String = \"recommended\";\n\tpublic static inline var CANVAS:String = \"canvas\";\n\tpublic static inline var WEBGL:String = \"webgl\";\n\n\tvar _frameCount:Int;\n\tvar _animationFrameId:Null;\n\n\tpublic function new() {\n\t\t_setDefaultValues();\n\t}\n\n\tfunction set_fps(val:Int):Int {\n\t\t_frameCount = 0;\n\t\treturn fps = (val >= 1 && val < 60) ? Std.int(val) : 60;\n\t}\n\n\tfunction set_skipFrame(val:Bool):Bool {\n\t\tif (val) {\n\t\t\ttrace(\"pixi.plugins.app.Application > Deprecated: skipFrame - use fps property and set it to 30 instead\");\n\t\t\tfps = 30;\n\t\t}\n\t\treturn skipFrame = val;\n\t}\n\n\tinline function _setDefaultValues() {\n\t\t_animationFrameId = null;\n\t\tpixelRatio = 1;\n\t\tskipFrame = false;\n\t\tautoResize = true;\n\t\ttransparent = false;\n\t\tantialias = false;\n\t\tforceFXAA = false;\n\t\troundPixels = false;\n\t\tclearBeforeRender = true;\n\t\tpreserveDrawingBuffer = false;\n\t\tbackgroundColor = 0xFFFFFF;\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tposition = \"static\";\n\t\tfps = 60;\n\t}\n\n\t/**\n\t * Starts pixi application setup using the properties set or default values\n\t * @param [rendererType] - Renderer type to use AUTO (default) | CANVAS | WEBGL\n\t * @param [stats] - Enable/disable stats for the application.\n\t * Note that stats.js is not part of pixi so don't forget to include it you html page\n\t * Can be found in libs folder. \"libs/stats.min.js\" \n\t * @param [parentDom] - By default canvas will be appended to body or it can be appended to custom element if passed\n\t */\n\n\tpublic function start(?rendererType:String = \"auto\", ?parentDom:Element, ?canvasElement:CanvasElement) {\n\t\tif (canvasElement == null) {\n\t\t\tcanvas = Browser.document.createCanvasElement();\n\t\t\tcanvas.style.width = width + \"px\";\n\t\t\tcanvas.style.height = height + \"px\";\n\t\t\tcanvas.style.position = position;\n\t\t}\n\t\telse canvas = canvasElement;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(canvas);\n\t\telse parentDom.appendChild(canvas);\n\n\t\tstage = new Container();\n\n\t\tvar renderingOptions:RenderingOptions = {};\n\t\trenderingOptions.view = canvas;\n\t\trenderingOptions.backgroundColor = backgroundColor;\n\t\trenderingOptions.resolution = pixelRatio;\n\t\trenderingOptions.antialias = antialias;\n\t\trenderingOptions.forceFXAA = forceFXAA;\n\t\trenderingOptions.autoResize = autoResize;\n\t\trenderingOptions.transparent = transparent;\n\t\trenderingOptions.clearBeforeRender = clearBeforeRender;\n\t\trenderingOptions.preserveDrawingBuffer = preserveDrawingBuffer;\n\n\t\tif (rendererType == AUTO) renderer = Detector.autoDetectRenderer(width, height, renderingOptions);\n\t\telse if (rendererType == CANVAS) renderer = new CanvasRenderer(width, height, renderingOptions);\n\t\telse renderer = new WebGLRenderer(width, height, renderingOptions);\n\n\t\tif (roundPixels) renderer.roundPixels = true;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(renderer.view);\n\t\telse parentDom.appendChild(renderer.view);\n\t\tresumeRendering();\n\t\t#if stats addStats(); #end\n\t}\n\n\tpublic function pauseRendering() {\n\t\tBrowser.window.onresize = null;\n\t\tif (_animationFrameId != null) {\n\t\t\tBrowser.window.cancelAnimationFrame(_animationFrameId);\n\t\t\t_animationFrameId = null;\n\t\t}\n\t}\n\n\tpublic function resumeRendering() {\n\t\tif (autoResize) Browser.window.onresize = _onWindowResize;\n\t\tif (_animationFrameId == null) _animationFrameId = Browser.window.requestAnimationFrame(_onRequestAnimationFrame);\n\t}\n\n\t@:noCompletion function _onWindowResize(event:Event) {\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\trenderer.resize(width, height);\n\t\tcanvas.style.width = width + \"px\";\n\t\tcanvas.style.height = height + \"px\";\n\n\t\tif (onResize != null) onResize();\n\t}\n\n\t@:noCompletion function _onRequestAnimationFrame(elapsedTime:Float) {\n\t\t_frameCount++;\n\t\tif (_frameCount == Std.int(60 / fps)) {\n\t\t\t_frameCount = 0;\n\t\t\tif (onUpdate != null) onUpdate(elapsedTime);\n\t\t\trenderer.render(stage);\n\t\t}\n\t\t_animationFrameId = Browser.window.requestAnimationFrame(_onRequestAnimationFrame);\n\t}\n\n\tpublic function addStats() {\n\t\tif (untyped __js__(\"window\").Perf != null) {\n\t\t\tnew Perf().addInfo([\"UNKNOWN\", \"WEBGL\", \"CANVAS\"][renderer.type] + \" - \" + pixelRatio);\n\t\t}\n\t}\n}","package filters.blur;\n\nimport js.Browser;\nimport pixi.core.display.Container;\nimport pixi.filters.blur.BlurFilter;\nimport pixi.core.sprites.Sprite;\nimport pixi.plugins.app.Application;\n\nclass Main extends Application {\n\n\tvar _bg:Sprite;\n\tvar _container:Container;\n\tvar _littleDudes:Sprite;\n\tvar _littleRobot:Sprite;\n\n\tvar _blurFilter1:BlurFilter;\n\tvar _blurFilter2:BlurFilter;\n\n\tvar _count:Float;\n\n\tpublic function new() {\n\t\tsuper();\n\t\t_init();\n\n\t\t_container = new Container();\n\t\tstage.addChild(_container);\n\t\t_container.position.set(Browser.window.innerWidth / 2, Browser.window.innerHeight / 2);\n\n\t\t_bg = Sprite.fromImage(\"assets/filters/depth_blur_BG.jpg\");\n\t\t_bg.anchor.set(0.5);\n\t\t_container.addChild(_bg);\n\n\t\t_littleDudes = Sprite.fromImage(\"assets/filters/depth_blur_dudes.jpg\");\n\t\t_littleDudes.anchor.set(0.5);\n\t\t_littleDudes.y = 100;\n\t\t_container.addChild(_littleDudes);\n\n\t\t_littleRobot = Sprite.fromImage(\"assets/filters/depth_blur_moby.jpg\");\n\t\t_littleRobot.anchor.set(0.5);\n\t\t_littleRobot.x = 120;\n\t\t_container.addChild(_littleRobot);\n\n\t\t_blurFilter1 = new BlurFilter();\n\t\t_blurFilter2 = new BlurFilter();\n\n\t\t_littleDudes.filters = [_blurFilter1];\n\t\t_littleRobot.filters = [_blurFilter2];\n\n\t\t_count = 0;\n\t}\n\n\tfunction _init() {\n\t\tposition = \"fixed\";\n\t\tbackgroundColor = 0xFFFFFF;\n\t\tonUpdate = _onUpdate;\n\t\tsuper.start();\n\t}\n\n\tfunction _onUpdate(elapsedTime:Float) {\n\t\t_count += 0.01;\n\n\t\tvar blurAmount1 = Math.cos(_count);\n\t\tvar blurAmount2 = Math.sin(_count);\n\n\t\t_blurFilter1.blur = 20 * (blurAmount1);\n\t\t_blurFilter2.blur = 20 * (blurAmount2);\n\t}\n\n\tstatic function main() {\n\t\tnew Main();\n\t}\n}"],
+"sourcesContent":["import js.html.Performance;\nimport js.html.DivElement;\nimport js.Browser;\n\n@:expose class Perf {\n\n\tpublic static var MEASUREMENT_INTERVAL:Int = 1000;\n\n\tpublic static var FONT_FAMILY:String = \"Helvetica,Arial\";\n\n\tpublic static var FPS_BG_CLR:String = \"#00FF00\";\n\tpublic static var FPS_WARN_BG_CLR:String = \"#FF8000\";\n\tpublic static var FPS_PROB_BG_CLR:String = \"#FF0000\";\n\n\tpublic static var MS_BG_CLR:String = \"#FFFF00\";\n\tpublic static var MEM_BG_CLR:String = \"#086A87\";\n\tpublic static var INFO_BG_CLR:String = \"#00FFFF\";\n\tpublic static var FPS_TXT_CLR:String = \"#000000\";\n\tpublic static var MS_TXT_CLR:String = \"#000000\";\n\tpublic static var MEM_TXT_CLR:String = \"#FFFFFF\";\n\tpublic static var INFO_TXT_CLR:String = \"#000000\";\n\n\tpublic static var TOP_LEFT:String = \"TL\";\n\tpublic static var TOP_RIGHT:String = \"TR\";\n\tpublic static var BOTTOM_LEFT:String = \"BL\";\n\tpublic static var BOTTOM_RIGHT:String = \"BR\";\n\n\tstatic var DELAY_TIME:Int = 4000;\n\n\tpublic var fps:DivElement;\n\tpublic var ms:DivElement;\n\tpublic var memory:DivElement;\n\tpublic var info:DivElement;\n\n\tpublic var lowFps:Float;\n\tpublic var avgFps:Float;\n\tpublic var currentFps:Float;\n\tpublic var currentMs:Float;\n\tpublic var currentMem:String;\n\n\tvar _time:Float;\n\tvar _startTime:Float;\n\tvar _prevTime:Float;\n\tvar _ticks:Int;\n\tvar _fpsMin:Float;\n\tvar _fpsMax:Float;\n\tvar _memCheck:Bool;\n\tvar _pos:String;\n\tvar _offset:Float;\n\tvar _measureCount:Int;\n\tvar _totalFps:Float;\n\n\tvar _perfObj:Performance;\n\tvar _memoryObj:Memory;\n\tvar _raf:Int;\n\n\tvar RAF:Dynamic;\n\tvar CAF:Dynamic;\n\n\tpublic function new(?pos = \"TR\", ?offset:Float = 0) {\n\t\t_perfObj = Browser.window.performance;\n\t\tif (Reflect.field(_perfObj, \"memory\") != null) _memoryObj = Reflect.field(_perfObj, \"memory\");\n\t\t_memCheck = (_perfObj != null && _memoryObj != null && _memoryObj.totalJSHeapSize > 0);\n\n\t\t_pos = pos;\n\t\t_offset = offset;\n\n\t\t_init();\n\t\t_createFpsDom();\n\t\t_createMsDom();\n\t\tif (_memCheck) _createMemoryDom();\n\n\t\tif (Browser.window.requestAnimationFrame != null) RAF = Browser.window.requestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozRequestAnimationFrame != null) RAF = untyped __js__(\"window\").mozRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitRequestAnimationFrame != null) RAF = untyped __js__(\"window\").webkitRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msRequestAnimationFrame != null) RAF = untyped __js__(\"window\").msRequestAnimationFrame;\n\n\t\tif (Browser.window.cancelAnimationFrame != null) CAF = Browser.window.cancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozCancelAnimationFrame != null) CAF = untyped __js__(\"window\").mozCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitCancelAnimationFrame != null) CAF = untyped __js__(\"window\").webkitCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msCancelAnimationFrame != null) CAF = untyped __js__(\"window\").msCancelAnimationFrame;\n\n\t\tif (RAF != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tinline function _init() {\n\t\tcurrentFps = 60;\n\t\tcurrentMs = 0;\n\t\tcurrentMem = \"0\";\n\n\t\tlowFps = 60;\n\t\tavgFps = 60;\n\n\t\t_measureCount = 0;\n\t\t_totalFps = 0;\n\t\t_time = 0;\n\t\t_ticks = 0;\n\t\t_fpsMin = 60;\n\t\t_fpsMax = 60;\n\t\t_startTime = _now();\n\t\t_prevTime = -MEASUREMENT_INTERVAL;\n\t}\n\n\tinline function _now():Float {\n\t\treturn (_perfObj != null && _perfObj.now != null) ? _perfObj.now() : Date.now().getTime();\n\t}\n\n\tfunction _tick(val:Float) {\n\t\tvar time = _now();\n\t\t_ticks++;\n\n\t\tif (_raf != null && time > _prevTime + MEASUREMENT_INTERVAL) {\n\t\t\tcurrentMs = Math.round(time - _startTime);\n\t\t\tms.innerHTML = \"MS: \" + currentMs;\n\n\t\t\tcurrentFps = Math.round((_ticks * 1000) / (time - _prevTime));\n\t\t\tif (currentFps > 0 && val > DELAY_TIME) {\n\t\t\t\t_measureCount++;\n\t\t\t\t_totalFps += currentFps;\n\t\t\t\tlowFps = _fpsMin = Math.min(_fpsMin, currentFps);\n\t\t\t\t_fpsMax = Math.max(_fpsMax, currentFps);\n\t\t\t\tavgFps = Math.round(_totalFps / _measureCount);\n\t\t\t}\n\n\t\t\tfps.innerHTML = \"FPS: \" + currentFps + \" (\" + _fpsMin + \"-\" + _fpsMax + \")\";\n\n\t\t\tif (currentFps >= 30) fps.style.backgroundColor = FPS_BG_CLR;\n\t\t\telse if (currentFps >= 15) fps.style.backgroundColor = FPS_WARN_BG_CLR;\n\t\t\telse fps.style.backgroundColor = FPS_PROB_BG_CLR;\n\n\t\t\t_prevTime = time;\n\t\t\t_ticks = 0;\n\n\t\t\tif (_memCheck) {\n\t\t\t\tcurrentMem = _getFormattedSize(_memoryObj.usedJSHeapSize, 2);\n\t\t\t\tmemory.innerHTML = \"MEM: \" + currentMem;\n\t\t\t}\n\t\t}\n\t\t_startTime = time;\n\n\t\tif (_raf != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tfunction _createDiv(id:String, ?top:Float = 0):DivElement {\n\t\tvar div:DivElement = Browser.document.createDivElement();\n\t\tdiv.id = id;\n\t\tdiv.className = id;\n\t\tdiv.style.position = \"absolute\";\n\n\t\tswitch (_pos) {\n\t\t\tcase \"TL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"TR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"BL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t\tcase \"BR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t}\n\n\t\tdiv.style.width = \"80px\";\n\t\tdiv.style.height = \"12px\";\n\t\tdiv.style.lineHeight = \"12px\";\n\t\tdiv.style.padding = \"2px\";\n\t\tdiv.style.fontFamily = FONT_FAMILY;\n\t\tdiv.style.fontSize = \"9px\";\n\t\tdiv.style.fontWeight = \"bold\";\n\t\tdiv.style.textAlign = \"center\";\n\t\tBrowser.document.body.appendChild(div);\n\t\treturn div;\n\t}\n\n\tfunction _createFpsDom() {\n\t\tfps = _createDiv(\"fps\");\n\t\tfps.style.backgroundColor = FPS_BG_CLR;\n\t\tfps.style.zIndex = \"995\";\n\t\tfps.style.color = FPS_TXT_CLR;\n\t\tfps.innerHTML = \"FPS: 0\";\n\t}\n\n\tfunction _createMsDom() {\n\t\tms = _createDiv(\"ms\", 16);\n\t\tms.style.backgroundColor = MS_BG_CLR;\n\t\tms.style.zIndex = \"996\";\n\t\tms.style.color = MS_TXT_CLR;\n\t\tms.innerHTML = \"MS: 0\";\n\t}\n\n\tfunction _createMemoryDom() {\n\t\tmemory = _createDiv(\"memory\", 32);\n\t\tmemory.style.backgroundColor = MEM_BG_CLR;\n\t\tmemory.style.color = MEM_TXT_CLR;\n\t\tmemory.style.zIndex = \"997\";\n\t\tmemory.innerHTML = \"MEM: 0\";\n\t}\n\n\tfunction _getFormattedSize(bytes:Float, ?frac:Int = 0):String {\n\t\tvar sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n\t\tif (bytes == 0) return \"0\";\n\t\tvar precision = Math.pow(10, frac);\n\t\tvar i = Math.floor(Math.log(bytes) / Math.log(1024));\n\t\treturn Math.round(bytes * precision / Math.pow(1024, i)) / precision + \" \" + sizes[i];\n\t}\n\n\tpublic function addInfo(val:String) {\n\t\tinfo = _createDiv(\"info\", (_memCheck) ? 48 : 32);\n\t\tinfo.style.backgroundColor = INFO_BG_CLR;\n\t\tinfo.style.color = INFO_TXT_CLR;\n\t\tinfo.style.zIndex = \"998\";\n\t\tinfo.innerHTML = val;\n\t}\n\n\tpublic function clearInfo() {\n\t\tif (info != null) {\n\t\t\tBrowser.document.body.removeChild(info);\n\t\t\tinfo = null;\n\t\t}\n\t}\n\n\tpublic function destroy() {\n\t\t_cancelRAF();\n\t\t_perfObj = null;\n\t\t_memoryObj = null;\n\t\tif (fps != null) {\n\t\t\tBrowser.document.body.removeChild(fps);\n\t\t\tfps = null;\n\t\t}\n\t\tif (ms != null) {\n\t\t\tBrowser.document.body.removeChild(ms);\n\t\t\tms = null;\n\t\t}\n\t\tif (memory != null) {\n\t\t\tBrowser.document.body.removeChild(memory);\n\t\t\tmemory = null;\n\t\t}\n\t\tclearInfo();\n\t\t_init();\n\t}\n\n\tinline function _cancelRAF() {\n\t\tReflect.callMethod(Browser.window, CAF, [_raf]);\n\t\t_raf = null;\n\t}\n}\n\ntypedef Memory = {\n\tvar usedJSHeapSize:Float;\n\tvar totalJSHeapSize:Float;\n\tvar jsHeapSizeLimit:Float;\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class Reflect {\n\n\tpublic inline static function hasField( o : Dynamic, field : String ) : Bool {\n\t\treturn untyped __js__('Object').prototype.hasOwnProperty.call(o, field);\n\t}\n\n\tpublic static function field( o : Dynamic, field : String ) : Dynamic {\n\t\ttry return untyped o[field] catch( e : Dynamic ) return null;\n\t}\n\n\tpublic inline static function setField( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\to[field] = value;\n\t}\n\n\tpublic static inline function getProperty( o : Dynamic, field : String ) : Dynamic untyped {\n\t\tvar tmp;\n\t\treturn if( o == null ) __define_feature__(\"Reflect.getProperty\",null) else if( o.__properties__ && (tmp=o.__properties__[\"get_\"+field]) ) o[tmp]() else o[field];\n\t}\n\n\tpublic static inline function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\tvar tmp;\n\t\tif( o.__properties__ && (tmp=o.__properties__[\"set_\"+field]) ) o[tmp](value) else o[field] = __define_feature__(\"Reflect.setProperty\",value);\n\t}\n\n\tpublic inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array ) : Dynamic untyped {\n\t\treturn func.apply(o,args);\n\t}\n\n\tpublic static function fields( o : Dynamic ) : Array {\n\t\tvar a = [];\n\t\tif (o != null) untyped {\n\t\t\tvar hasOwnProperty = __js__('Object').prototype.hasOwnProperty;\n\t\t\t__js__(\"for( var f in o ) {\");\n\t\t\tif( f != \"__id__\" && f != \"hx__closures__\" && hasOwnProperty.call(o, f) ) a.push(f);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static function isFunction( f : Dynamic ) : Bool untyped {\n\t\treturn __js__(\"typeof(f)\") == \"function\" && !(js.Boot.isClass(f) || js.Boot.isEnum(f));\n\t}\n\n\tpublic static function compare( a : T, b : T ) : Int {\n\t\treturn ( a == b ) ? 0 : (((cast a) > (cast b)) ? 1 : -1);\n\t}\n\n\tpublic static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool {\n\t\tif( f1 == f2 )\n\t\t\treturn true;\n\t\tif( !isFunction(f1) || !isFunction(f2) )\n\t\t\treturn false;\n\t\treturn f1.scope == f2.scope && f1.method == f2.method && f1.method != null;\n\t}\n\n\tpublic static function isObject( v : Dynamic ) : Bool untyped {\n\t\tif( v == null )\n\t\t\treturn false;\n\t\tvar t = __js__(\"typeof(v)\");\n\t\treturn (t == \"string\" || (t == \"object\" && v.__enum__ == null)) || (t == \"function\" && (js.Boot.isClass(v) || js.Boot.isEnum(v)) != null);\n\t}\n\n\tpublic static function isEnumValue( v : Dynamic ) : Bool {\n\t\treturn v != null && v.__enum__ != null;\n\t}\n\n\tpublic static function deleteField( o : Dynamic, field : String ) : Bool untyped {\n\t\tif( !hasField(o,field) ) return false;\n\t\t__js__(\"delete\")(o[field]);\n\t\treturn true;\n\t}\n\n\tpublic static function copy( o : T ) : T {\n\t\tvar o2 : Dynamic = {};\n\t\tfor( f in Reflect.fields(o) )\n\t\t\tReflect.setField(o2,f,Reflect.field(o,f));\n\t\treturn o2;\n\t}\n\n\t@:overload(function( f : Array -> Void ) : Dynamic {})\n\tpublic static function makeVarArgs( f : Array -> Dynamic ) : Dynamic {\n\t\treturn function() {\n\t\t\tvar a = untyped Array.prototype.slice.call(__js__(\"arguments\"));\n\t\t\treturn f(a);\n\t\t};\n\t}\n\n}\n","package pixi.plugins.app;\n\nimport pixi.core.renderers.SystemRenderer;\nimport js.html.Event;\nimport pixi.core.RenderOptions;\nimport pixi.core.display.Container;\nimport js.html.Element;\nimport js.html.CanvasElement;\nimport js.Browser;\n\n/**\n * Pixi Boilerplate Helper class that can be used by any application\n * @author Adi Reddy Mora\n * http://adireddy.github.io\n * @license MIT\n * @copyright 2015\n */\nclass Application {\n\n\t/**\n * Sets the pixel ratio of the application.\n * default - 1\n */\n\tpublic var pixelRatio:Float;\n\n\t/**\n\t * Width of the application.\n\t * default - Browser.window.innerWidth\n\t */\n\tpublic var width:Float;\n\n\t/**\n\t * Height of the application.\n\t * default - Browser.window.innerHeight\n\t */\n\tpublic var height:Float;\n\n\t/**\n\t * Position of canvas element\n\t * default - static\n\t */\n\tpublic var position:String;\n\n\t/**\n\t * Renderer transparency property.\n\t * default - false\n\t */\n\tpublic var transparent:Bool;\n\n\t/**\n\t * Graphics antialias property.\n\t * default - false\n\t */\n\tpublic var antialias:Bool;\n\n\t/**\n\t * Force FXAA shader antialias instead of native (faster).\n\t * default - false\n\t */\n\tpublic var forceFXAA:Bool;\n\n\t/**\n\t * Force round pixels.\n\t * default - false\n\t */\n\tpublic var roundPixels:Bool;\n\n\t/**\n\t * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.\n * If the scene is transparent Pixi will use clearRect to clear the canvas every frame.\n * Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.\n\t * default - true\n\t */\n\tpublic var clearBeforeRender:Bool;\n\n\t/**\n\t * enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context\n\t * default - false\n\t */\n\tpublic var preserveDrawingBuffer:Bool;\n\n\t/**\n\t * Whether you want to resize the canvas and renderer on browser resize.\n\t * Should be set to false when custom width and height are used for the application.\n\t * default - true\n\t */\n\tpublic var autoResize:Bool;\n\n\t/**\n\t * Sets the background color of the stage.\n\t * default - 0xFFFFFF\n\t */\n\tpublic var backgroundColor:Int;\n\n\t/**\n\t * Update listener \tfunction\n\t */\n\tpublic var onUpdate:Float -> Void;\n\n\t/**\n\t * Window resize listener \tfunction\n\t */\n\tpublic var onResize:Void -> Void;\n\n\t/**\n\t * Canvas Element\n\t * Read-only\n\t */\n\tpublic var canvas(default, null):CanvasElement;\n\n\t/**\n\t * Renderer\n\t * Read-only\n\t */\n\tpublic var renderer(default, null):SystemRenderer;\n\n\t/**\n\t * Global Container.\n\t * Read-only\n\t */\n\tpublic var stage(default, null):Container;\n\n\t/**\n\t * Pixi Application\n\t * Read-only\n\t */\n\tpublic var app(default, null):pixi.core.Application;\n\n\tpublic static inline var AUTO:String = \"auto\";\n\tpublic static inline var RECOMMENDED:String = \"recommended\";\n\tpublic static inline var CANVAS:String = \"canvas\";\n\tpublic static inline var WEBGL:String = \"webgl\";\n\n\tpublic static inline var POSITION_STATIC:String = \"static\";\n\tpublic static inline var POSITION_ABSOLUTE:String = \"absolute\";\n\tpublic static inline var POSITION_FIXED:String = \"fixed\";\n\tpublic static inline var POSITION_RELATIVE:String = \"relative\";\n\tpublic static inline var POSITION_INITIAL:String = \"initial\";\n\tpublic static inline var POSITION_INHERIT:String = \"inherit\";\n\n\tvar _frameCount:Int;\n\tvar _animationFrameId:Null;\n\n\tpublic function new() {\n\t\t_setDefaultValues();\n\t}\n\n\tinline function _setDefaultValues() {\n\t\t_animationFrameId = null;\n\t\tpixelRatio = 1;\n\t\tautoResize = true;\n\t\ttransparent = false;\n\t\tantialias = false;\n\t\tforceFXAA = false;\n\t\troundPixels = false;\n\t\tclearBeforeRender = true;\n\t\tpreserveDrawingBuffer = false;\n\t\tbackgroundColor = 0xFFFFFF;\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tposition = \"static\";\n\t}\n\n\t/**\n\t * Starts pixi application setup using the properties set or default values\n\t * @param [rendererType] - Renderer type to use AUTO (default) | CANVAS | WEBGL\n\t * @param [stats] - Enable/disable stats for the application.\n\t * Note that stats.js is not part of pixi so don't forget to include it you html page\n\t * Can be found in libs folder. \"libs/stats.min.js\" \n\t * @param [parentDom] - By default canvas will be appended to body or it can be appended to custom element if passed\n\t */\n\n\tpublic function start(?rendererType:String = \"auto\", ?parentDom:Element, ?canvasElement:CanvasElement) {\n\t\tif (canvasElement == null) {\n\t\t\tcanvas = Browser.document.createCanvasElement();\n\t\t\tcanvas.style.width = width + \"px\";\n\t\t\tcanvas.style.height = height + \"px\";\n\t\t\tcanvas.style.position = position;\n\t\t}\n\t\telse canvas = canvasElement;\n\n\t\tif (autoResize) Browser.window.onresize = _onWindowResize;\n\n\t\tvar renderingOptions:RenderOptions = {};\n\t\trenderingOptions.view = canvas;\n\t\trenderingOptions.backgroundColor = backgroundColor;\n\t\trenderingOptions.resolution = pixelRatio;\n\t\trenderingOptions.antialias = antialias;\n\t\trenderingOptions.forceFXAA = forceFXAA;\n\t\trenderingOptions.autoResize = autoResize;\n\t\trenderingOptions.transparent = transparent;\n\t\trenderingOptions.clearBeforeRender = clearBeforeRender;\n\t\trenderingOptions.preserveDrawingBuffer = preserveDrawingBuffer;\n\t\trenderingOptions.roundPixels = roundPixels;\n\n\t\tswitch (rendererType) {\n\t\t\tcase CANVAS: app = new pixi.core.Application(width, height, renderingOptions, true);\n\t\t\tdefault: app = new pixi.core.Application(width, height, renderingOptions);\n\t\t}\n\n\t\tstage = app.stage;\n\t\trenderer = app.renderer;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(app.view);\n\t\telse parentDom.appendChild(app.view);\n\n\t\tapp.ticker.add(_onRequestAnimationFrame);\n\n\t\t#if stats addStats(); #end\n\t}\n\n\tpublic function pauseRendering() {\n\t\tapp.stop();\n\t}\n\n\tpublic function resumeRendering() {\n\t\tapp.start();\n\t}\n\n\t@:noCompletion function _onWindowResize(event:Event) {\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tapp.renderer.resize(width, height);\n\t\tcanvas.style.width = width + \"px\";\n\t\tcanvas.style.height = height + \"px\";\n\n\t\tif (onResize != null) onResize();\n\t}\n\n\t@:noCompletion function _onRequestAnimationFrame() {\n\t\tif (onUpdate != null) onUpdate(app.ticker.deltaTime);\n\t}\n\n\tpublic function addStats() {\n\t\tif (untyped __js__(\"window\").Perf != null) {\n\t\t\tnew Perf().addInfo([\"UNKNOWN\", \"WEBGL\", \"CANVAS\"][app.renderer.type] + \" - \" + pixelRatio);\n\t\t}\n\t}\n}","package filters.blur;\n\nimport js.Browser;\nimport pixi.core.display.Container;\nimport pixi.filters.blur.BlurFilter;\nimport pixi.core.sprites.Sprite;\nimport pixi.plugins.app.Application;\n\nclass Main extends Application {\n\n\tvar _bg:Sprite;\n\tvar _container:Container;\n\tvar _littleDudes:Sprite;\n\tvar _littleRobot:Sprite;\n\n\tvar _blurFilter1:BlurFilter;\n\tvar _blurFilter2:BlurFilter;\n\n\tvar _count:Float;\n\n\tpublic function new() {\n\t\tsuper();\n\t\t_init();\n\n\t\t_container = new Container();\n\t\tstage.addChild(_container);\n\t\t_container.position.set(Browser.window.innerWidth / 2, Browser.window.innerHeight / 2);\n\n\t\t_bg = Sprite.fromImage(\"assets/filters/depth_blur_BG.jpg\");\n\t\t_bg.anchor.set(0.5);\n\t\t_container.addChild(_bg);\n\n\t\t_littleDudes = Sprite.fromImage(\"assets/filters/depth_blur_dudes.jpg\");\n\t\t_littleDudes.anchor.set(0.5);\n\t\t_littleDudes.y = 100;\n\t\t_container.addChild(_littleDudes);\n\n\t\t_littleRobot = Sprite.fromImage(\"assets/filters/depth_blur_moby.jpg\");\n\t\t_littleRobot.anchor.set(0.5);\n\t\t_littleRobot.x = 120;\n\t\t_container.addChild(_littleRobot);\n\n\t\t_blurFilter1 = new BlurFilter();\n\t\t_blurFilter2 = new BlurFilter();\n\n\t\t_littleDudes.filters = [_blurFilter1];\n\t\t_littleRobot.filters = [_blurFilter2];\n\n\t\t_count = 0;\n\t}\n\n\tfunction _init() {\n\t\tposition = \"fixed\";\n\t\tbackgroundColor = 0xFFFFFF;\n\t\tonUpdate = _onUpdate;\n\t\tsuper.start();\n\t}\n\n\tfunction _onUpdate(elapsedTime:Float) {\n\t\t_count += 0.01;\n\n\t\tvar blurAmount1 = Math.cos(_count);\n\t\tvar blurAmount2 = Math.sin(_count);\n\n\t\t_blurFilter1.blur = 20 * (blurAmount1);\n\t\t_blurFilter2.blur = 20 * (blurAmount2);\n\t}\n\n\tstatic function main() {\n\t\tnew Main();\n\t}\n}"],
"names":[],
-"mappings":";;;;;;;mBA2DO;;;CACN,EAAW;CACX,CAAI,DAAc,AAAU,GAAa,HAAM,EAAa,FAAc,A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AAS;EAE3B,CAAoB,AAAK;EACzB,CAAoB,AAAK;;;;;4BH3DmB;mBAEN;kBAED;uBACK;uBACA;iBAEN;kBACC;mBACC;mBACA;kBACD;mBACC;oBACC;kBAOZ;;;;"
}
\ No newline at end of file
diff --git a/samples/_output/bunnymark.js b/samples/_output/bunnymark.js
index 5d840a05..ff8eaa71 100644
--- a/samples/_output/bunnymark.js
+++ b/samples/_output/bunnymark.js
@@ -160,7 +160,6 @@ bunnymark_Bunny.prototype = $extend(PIXI.Sprite.prototype,{
var pixi_plugins_app_Application = function() {
this._animationFrameId = null;
this.pixelRatio = 1;
- this.set_skipFrame(false);
this.autoResize = true;
this.transparent = false;
this.antialias = false;
@@ -172,21 +171,9 @@ var pixi_plugins_app_Application = function() {
this.width = window.innerWidth;
this.height = window.innerHeight;
this.position = "static";
- this.set_fps(60);
};
pixi_plugins_app_Application.prototype = {
- set_fps: function(val) {
- this._frameCount = 0;
- return val >= 1 && val < 60?this.fps = val | 0:this.fps = 60;
- }
- ,set_skipFrame: function(val) {
- if(val) {
- console.log("pixi.plugins.app.Application > Deprecated: skipFrame - use fps property and set it to 30 instead");
- this.set_fps(30);
- }
- return this.skipFrame = val;
- }
- ,start: function(rendererType,parentDom,canvasElement) {
+ start: function(rendererType,parentDom,canvasElement) {
if(rendererType == null) rendererType = "auto";
if(canvasElement == null) {
var _this = window.document;
@@ -195,8 +182,7 @@ pixi_plugins_app_Application.prototype = {
this.canvas.style.height = this.height + "px";
this.canvas.style.position = this.position;
} else this.canvas = canvasElement;
- if(parentDom == null) window.document.body.appendChild(this.canvas); else parentDom.appendChild(this.canvas);
- this.stage = new PIXI.Container();
+ if(this.autoResize) window.onresize = $bind(this,this._onWindowResize);
var renderingOptions = { };
renderingOptions.view = this.canvas;
renderingOptions.backgroundColor = this.backgroundColor;
@@ -207,35 +193,33 @@ pixi_plugins_app_Application.prototype = {
renderingOptions.transparent = this.transparent;
renderingOptions.clearBeforeRender = this.clearBeforeRender;
renderingOptions.preserveDrawingBuffer = this.preserveDrawingBuffer;
- if(rendererType == "auto") this.renderer = PIXI.autoDetectRenderer(this.width,this.height,renderingOptions); else if(rendererType == "canvas") this.renderer = new PIXI.CanvasRenderer(this.width,this.height,renderingOptions); else this.renderer = new PIXI.WebGLRenderer(this.width,this.height,renderingOptions);
- if(this.roundPixels) this.renderer.roundPixels = true;
- if(parentDom == null) window.document.body.appendChild(this.renderer.view); else parentDom.appendChild(this.renderer.view);
- this.resumeRendering();
+ renderingOptions.roundPixels = this.roundPixels;
+ if(rendererType != null) switch(rendererType) {
+ case "canvas":
+ this.app = new PIXI.Application(this.width,this.height,renderingOptions,true);
+ break;
+ default:
+ this.app = new PIXI.Application(this.width,this.height,renderingOptions);
+ } else this.app = new PIXI.Application(this.width,this.height,renderingOptions);
+ this.stage = this.app.stage;
+ this.renderer = this.app.renderer;
+ if(parentDom == null) window.document.body.appendChild(this.app.view); else parentDom.appendChild(this.app.view);
+ this.app.ticker.add($bind(this,this._onRequestAnimationFrame));
this.addStats();
}
- ,resumeRendering: function() {
- if(this.autoResize) window.onresize = $bind(this,this._onWindowResize);
- if(this._animationFrameId == null) this._animationFrameId = window.requestAnimationFrame($bind(this,this._onRequestAnimationFrame));
- }
,_onWindowResize: function(event) {
this.width = window.innerWidth;
this.height = window.innerHeight;
- this.renderer.resize(this.width,this.height);
+ this.app.renderer.resize(this.width,this.height);
this.canvas.style.width = this.width + "px";
this.canvas.style.height = this.height + "px";
if(this.onResize != null) this.onResize();
}
- ,_onRequestAnimationFrame: function(elapsedTime) {
- this._frameCount++;
- if(this._frameCount == (60 / this.fps | 0)) {
- this._frameCount = 0;
- if(this.onUpdate != null) this.onUpdate(elapsedTime);
- this.renderer.render(this.stage);
- }
- this._animationFrameId = window.requestAnimationFrame($bind(this,this._onRequestAnimationFrame));
+ ,_onRequestAnimationFrame: function() {
+ if(this.onUpdate != null) this.onUpdate(this.app.ticker.deltaTime);
}
,addStats: function() {
- if(window.Perf != null) new Perf().addInfo(["UNKNOWN","WEBGL","CANVAS"][this.renderer.type] + " - " + this.pixelRatio);
+ if(window.Perf != null) new Perf().addInfo(["UNKNOWN","WEBGL","CANVAS"][this.app.renderer.type] + " - " + this.pixelRatio);
}
};
var bunnymark_Main = function() {
@@ -261,7 +245,7 @@ bunnymark_Main.prototype = $extend(pixi_plugins_app_Application.prototype,{
this.backgroundColor = 9166286;
this.onUpdate = $bind(this,this._onUpdate);
this.onResize = $bind(this,this._onResize);
- this.set_fps(50);
+ this.autoResize = true;
pixi_plugins_app_Application.prototype.start.call(this);
this._setup();
}
diff --git a/samples/_output/bunnymark.js.map b/samples/_output/bunnymark.js.map
index 0f6a81d7..4598f3da 100644
--- a/samples/_output/bunnymark.js.map
+++ b/samples/_output/bunnymark.js.map
@@ -3,7 +3,7 @@
"file":"bunnymark.js",
"sourceRoot":"file:///",
"sources":["/projects/pixi-haxe/.haxelib/perf,js/1,1,8/src/Perf.hx","/usr/local/lib/haxe/std/js/_std/Reflect.hx","/usr/local/lib/haxe/std/js/_std/Std.hx","/projects/pixi-haxe/samples/bunnymark/Bunny.hx","/projects/pixi-haxe/src/pixi/plugins/app/Application.hx","/projects/pixi-haxe/samples/bunnymark/Main.hx"],
-"sourcesContent":["import js.html.Performance;\nimport js.html.DivElement;\nimport js.Browser;\n\n@:expose class Perf {\n\n\tpublic static var MEASUREMENT_INTERVAL:Int = 1000;\n\n\tpublic static var FONT_FAMILY:String = \"Helvetica,Arial\";\n\n\tpublic static var FPS_BG_CLR:String = \"#00FF00\";\n\tpublic static var FPS_WARN_BG_CLR:String = \"#FF8000\";\n\tpublic static var FPS_PROB_BG_CLR:String = \"#FF0000\";\n\n\tpublic static var MS_BG_CLR:String = \"#FFFF00\";\n\tpublic static var MEM_BG_CLR:String = \"#086A87\";\n\tpublic static var INFO_BG_CLR:String = \"#00FFFF\";\n\tpublic static var FPS_TXT_CLR:String = \"#000000\";\n\tpublic static var MS_TXT_CLR:String = \"#000000\";\n\tpublic static var MEM_TXT_CLR:String = \"#FFFFFF\";\n\tpublic static var INFO_TXT_CLR:String = \"#000000\";\n\n\tpublic static var TOP_LEFT:String = \"TL\";\n\tpublic static var TOP_RIGHT:String = \"TR\";\n\tpublic static var BOTTOM_LEFT:String = \"BL\";\n\tpublic static var BOTTOM_RIGHT:String = \"BR\";\n\n\tstatic var DELAY_TIME:Int = 4000;\n\n\tpublic var fps:DivElement;\n\tpublic var ms:DivElement;\n\tpublic var memory:DivElement;\n\tpublic var info:DivElement;\n\n\tpublic var lowFps:Float;\n\tpublic var avgFps:Float;\n\tpublic var currentFps:Float;\n\tpublic var currentMs:Float;\n\tpublic var currentMem:String;\n\n\tvar _time:Float;\n\tvar _startTime:Float;\n\tvar _prevTime:Float;\n\tvar _ticks:Int;\n\tvar _fpsMin:Float;\n\tvar _fpsMax:Float;\n\tvar _memCheck:Bool;\n\tvar _pos:String;\n\tvar _offset:Float;\n\tvar _measureCount:Int;\n\tvar _totalFps:Float;\n\n\tvar _perfObj:Performance;\n\tvar _memoryObj:Memory;\n\tvar _raf:Int;\n\n\tvar RAF:Dynamic;\n\tvar CAF:Dynamic;\n\n\tpublic function new(?pos = \"TR\", ?offset:Float = 0) {\n\t\t_perfObj = Browser.window.performance;\n\t\tif (Reflect.field(_perfObj, \"memory\") != null) _memoryObj = Reflect.field(_perfObj, \"memory\");\n\t\t_memCheck = (_perfObj != null && _memoryObj != null && _memoryObj.totalJSHeapSize > 0);\n\n\t\t_pos = pos;\n\t\t_offset = offset;\n\n\t\t_init();\n\t\t_createFpsDom();\n\t\t_createMsDom();\n\t\tif (_memCheck) _createMemoryDom();\n\n\t\tif (Browser.window.requestAnimationFrame != null) RAF = Browser.window.requestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozRequestAnimationFrame != null) RAF = untyped __js__(\"window\").mozRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitRequestAnimationFrame != null) RAF = untyped __js__(\"window\").webkitRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msRequestAnimationFrame != null) RAF = untyped __js__(\"window\").msRequestAnimationFrame;\n\n\t\tif (Browser.window.cancelAnimationFrame != null) CAF = Browser.window.cancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozCancelAnimationFrame != null) CAF = untyped __js__(\"window\").mozCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitCancelAnimationFrame != null) CAF = untyped __js__(\"window\").webkitCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msCancelAnimationFrame != null) CAF = untyped __js__(\"window\").msCancelAnimationFrame;\n\n\t\tif (RAF != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tinline function _init() {\n\t\tcurrentFps = 60;\n\t\tcurrentMs = 0;\n\t\tcurrentMem = \"0\";\n\n\t\tlowFps = 60;\n\t\tavgFps = 60;\n\n\t\t_measureCount = 0;\n\t\t_totalFps = 0;\n\t\t_time = 0;\n\t\t_ticks = 0;\n\t\t_fpsMin = 60;\n\t\t_fpsMax = 60;\n\t\t_startTime = _now();\n\t\t_prevTime = -MEASUREMENT_INTERVAL;\n\t}\n\n\tinline function _now():Float {\n\t\treturn (_perfObj != null && _perfObj.now != null) ? _perfObj.now() : Date.now().getTime();\n\t}\n\n\tfunction _tick(val:Float) {\n\t\tvar time = _now();\n\t\t_ticks++;\n\n\t\tif (_raf != null && time > _prevTime + MEASUREMENT_INTERVAL) {\n\t\t\tcurrentMs = Math.round(time - _startTime);\n\t\t\tms.innerHTML = \"MS: \" + currentMs;\n\n\t\t\tcurrentFps = Math.round((_ticks * 1000) / (time - _prevTime));\n\t\t\tif (currentFps > 0 && val > DELAY_TIME) {\n\t\t\t\t_measureCount++;\n\t\t\t\t_totalFps += currentFps;\n\t\t\t\tlowFps = _fpsMin = Math.min(_fpsMin, currentFps);\n\t\t\t\t_fpsMax = Math.max(_fpsMax, currentFps);\n\t\t\t\tavgFps = Math.round(_totalFps / _measureCount);\n\t\t\t}\n\n\t\t\tfps.innerHTML = \"FPS: \" + currentFps + \" (\" + _fpsMin + \"-\" + _fpsMax + \")\";\n\n\t\t\tif (currentFps >= 30) fps.style.backgroundColor = FPS_BG_CLR;\n\t\t\telse if (currentFps >= 15) fps.style.backgroundColor = FPS_WARN_BG_CLR;\n\t\t\telse fps.style.backgroundColor = FPS_PROB_BG_CLR;\n\n\t\t\t_prevTime = time;\n\t\t\t_ticks = 0;\n\n\t\t\tif (_memCheck) {\n\t\t\t\tcurrentMem = _getFormattedSize(_memoryObj.usedJSHeapSize, 2);\n\t\t\t\tmemory.innerHTML = \"MEM: \" + currentMem;\n\t\t\t}\n\t\t}\n\t\t_startTime = time;\n\n\t\tif (_raf != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tfunction _createDiv(id:String, ?top:Float = 0):DivElement {\n\t\tvar div:DivElement = Browser.document.createDivElement();\n\t\tdiv.id = id;\n\t\tdiv.className = id;\n\t\tdiv.style.position = \"absolute\";\n\n\t\tswitch (_pos) {\n\t\t\tcase \"TL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"TR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"BL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t\tcase \"BR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t}\n\n\t\tdiv.style.width = \"80px\";\n\t\tdiv.style.height = \"12px\";\n\t\tdiv.style.lineHeight = \"12px\";\n\t\tdiv.style.padding = \"2px\";\n\t\tdiv.style.fontFamily = FONT_FAMILY;\n\t\tdiv.style.fontSize = \"9px\";\n\t\tdiv.style.fontWeight = \"bold\";\n\t\tdiv.style.textAlign = \"center\";\n\t\tBrowser.document.body.appendChild(div);\n\t\treturn div;\n\t}\n\n\tfunction _createFpsDom() {\n\t\tfps = _createDiv(\"fps\");\n\t\tfps.style.backgroundColor = FPS_BG_CLR;\n\t\tfps.style.zIndex = \"995\";\n\t\tfps.style.color = FPS_TXT_CLR;\n\t\tfps.innerHTML = \"FPS: 0\";\n\t}\n\n\tfunction _createMsDom() {\n\t\tms = _createDiv(\"ms\", 16);\n\t\tms.style.backgroundColor = MS_BG_CLR;\n\t\tms.style.zIndex = \"996\";\n\t\tms.style.color = MS_TXT_CLR;\n\t\tms.innerHTML = \"MS: 0\";\n\t}\n\n\tfunction _createMemoryDom() {\n\t\tmemory = _createDiv(\"memory\", 32);\n\t\tmemory.style.backgroundColor = MEM_BG_CLR;\n\t\tmemory.style.color = MEM_TXT_CLR;\n\t\tmemory.style.zIndex = \"997\";\n\t\tmemory.innerHTML = \"MEM: 0\";\n\t}\n\n\tfunction _getFormattedSize(bytes:Float, ?frac:Int = 0):String {\n\t\tvar sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n\t\tif (bytes == 0) return \"0\";\n\t\tvar precision = Math.pow(10, frac);\n\t\tvar i = Math.floor(Math.log(bytes) / Math.log(1024));\n\t\treturn Math.round(bytes * precision / Math.pow(1024, i)) / precision + \" \" + sizes[i];\n\t}\n\n\tpublic function addInfo(val:String) {\n\t\tinfo = _createDiv(\"info\", (_memCheck) ? 48 : 32);\n\t\tinfo.style.backgroundColor = INFO_BG_CLR;\n\t\tinfo.style.color = INFO_TXT_CLR;\n\t\tinfo.style.zIndex = \"998\";\n\t\tinfo.innerHTML = val;\n\t}\n\n\tpublic function clearInfo() {\n\t\tif (info != null) {\n\t\t\tBrowser.document.body.removeChild(info);\n\t\t\tinfo = null;\n\t\t}\n\t}\n\n\tpublic function destroy() {\n\t\t_cancelRAF();\n\t\t_perfObj = null;\n\t\t_memoryObj = null;\n\t\tif (fps != null) {\n\t\t\tBrowser.document.body.removeChild(fps);\n\t\t\tfps = null;\n\t\t}\n\t\tif (ms != null) {\n\t\t\tBrowser.document.body.removeChild(ms);\n\t\t\tms = null;\n\t\t}\n\t\tif (memory != null) {\n\t\t\tBrowser.document.body.removeChild(memory);\n\t\t\tmemory = null;\n\t\t}\n\t\tclearInfo();\n\t\t_init();\n\t}\n\n\tinline function _cancelRAF() {\n\t\tReflect.callMethod(Browser.window, CAF, [_raf]);\n\t\t_raf = null;\n\t}\n}\n\ntypedef Memory = {\n\tvar usedJSHeapSize:Float;\n\tvar totalJSHeapSize:Float;\n\tvar jsHeapSizeLimit:Float;\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class Reflect {\n\n\tpublic inline static function hasField( o : Dynamic, field : String ) : Bool {\n\t\treturn untyped __js__('Object').prototype.hasOwnProperty.call(o, field);\n\t}\n\n\tpublic static function field( o : Dynamic, field : String ) : Dynamic {\n\t\ttry return untyped o[field] catch( e : Dynamic ) return null;\n\t}\n\n\tpublic inline static function setField( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\to[field] = value;\n\t}\n\n\tpublic static inline function getProperty( o : Dynamic, field : String ) : Dynamic untyped {\n\t\tvar tmp;\n\t\treturn if( o == null ) __define_feature__(\"Reflect.getProperty\",null) else if( o.__properties__ && (tmp=o.__properties__[\"get_\"+field]) ) o[tmp]() else o[field];\n\t}\n\n\tpublic static inline function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\tvar tmp;\n\t\tif( o.__properties__ && (tmp=o.__properties__[\"set_\"+field]) ) o[tmp](value) else o[field] = __define_feature__(\"Reflect.setProperty\",value);\n\t}\n\n\tpublic inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array ) : Dynamic untyped {\n\t\treturn func.apply(o,args);\n\t}\n\n\tpublic static function fields( o : Dynamic ) : Array {\n\t\tvar a = [];\n\t\tif (o != null) untyped {\n\t\t\tvar hasOwnProperty = __js__('Object').prototype.hasOwnProperty;\n\t\t\t__js__(\"for( var f in o ) {\");\n\t\t\tif( f != \"__id__\" && f != \"hx__closures__\" && hasOwnProperty.call(o, f) ) a.push(f);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static function isFunction( f : Dynamic ) : Bool untyped {\n\t\treturn __js__(\"typeof(f)\") == \"function\" && !(js.Boot.isClass(f) || js.Boot.isEnum(f));\n\t}\n\n\tpublic static function compare( a : T, b : T ) : Int {\n\t\treturn ( a == b ) ? 0 : (((cast a) > (cast b)) ? 1 : -1);\n\t}\n\n\tpublic static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool {\n\t\tif( f1 == f2 )\n\t\t\treturn true;\n\t\tif( !isFunction(f1) || !isFunction(f2) )\n\t\t\treturn false;\n\t\treturn f1.scope == f2.scope && f1.method == f2.method && f1.method != null;\n\t}\n\n\tpublic static function isObject( v : Dynamic ) : Bool untyped {\n\t\tif( v == null )\n\t\t\treturn false;\n\t\tvar t = __js__(\"typeof(v)\");\n\t\treturn (t == \"string\" || (t == \"object\" && v.__enum__ == null)) || (t == \"function\" && (js.Boot.isClass(v) || js.Boot.isEnum(v)) != null);\n\t}\n\n\tpublic static function isEnumValue( v : Dynamic ) : Bool {\n\t\treturn v != null && v.__enum__ != null;\n\t}\n\n\tpublic static function deleteField( o : Dynamic, field : String ) : Bool untyped {\n\t\tif( !hasField(o,field) ) return false;\n\t\t__js__(\"delete\")(o[field]);\n\t\treturn true;\n\t}\n\n\tpublic static function copy( o : T ) : T {\n\t\tvar o2 : Dynamic = {};\n\t\tfor( f in Reflect.fields(o) )\n\t\t\tReflect.setField(o2,f,Reflect.field(o,f));\n\t\treturn o2;\n\t}\n\n\t@:overload(function( f : Array -> Void ) : Dynamic {})\n\tpublic static function makeVarArgs( f : Array -> Dynamic ) : Dynamic {\n\t\treturn function() {\n\t\t\tvar a = untyped Array.prototype.slice.call(__js__(\"arguments\"));\n\t\t\treturn f(a);\n\t\t};\n\t}\n\n}\n","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport js.Boot;\n\n@:keepInit\n@:coreApi class Std {\n\n\tpublic static inline function is( v : Dynamic, t : Dynamic ) : Bool {\n\t\treturn untyped js.Boot.__instanceof(v,t);\n\t}\n\n\tpublic static inline function instance( value : T, c : Class ) : S {\n\t\treturn untyped __instanceof__(value, c) ? cast value : null;\n\t}\n\n\tpublic static function string( s : Dynamic ) : String {\n\t\treturn untyped js.Boot.__string_rec(s,\"\");\n\t}\n\n\tpublic static inline function int( x : Float ) : Int {\n\t\treturn (cast x) | 0;\n\t}\n\n\tpublic static function parseInt( x : String ) : Null {\n\t\tvar v = untyped __js__(\"parseInt\")(x, 10);\n\t\t// parse again if hexadecimal\n\t\tif( v == 0 && (x.charCodeAt(1) == 'x'.code || x.charCodeAt(1) == 'X'.code) )\n\t\t\tv = untyped __js__(\"parseInt\")(x);\n\t\tif( untyped __js__(\"isNaN\")(v) )\n\t\t\treturn null;\n\t\treturn cast v;\n\t}\n\n\tpublic static inline function parseFloat( x : String ) : Float {\n\t\treturn untyped __js__(\"parseFloat\")(x);\n\t}\n\n\tpublic static function random( x : Int ) : Int {\n\t\treturn untyped x <= 0 ? 0 : Math.floor(Math.random()*x);\n\t}\n\n\tstatic function __init__() : Void untyped {\n\t\t__feature__(\"js.Boot.getClass\",String.prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"String\"] = String,String));\n\t\t__feature__(\"js.Boot.isClass\",String.__name__ = __feature__(\"Type.getClassName\",[\"String\"],true));\n\t\t__feature__(\"Type.resolveClass\",$hxClasses[\"Array\"] = Array);\n\t\t__feature__(\"js.Boot.isClass\",Array.__name__ = __feature__(\"Type.getClassName\",[\"Array\"],true));\n\t\t__feature__(\"Date.*\", {\n\t\t\t__feature__(\"js.Boot.getClass\",__js__('Date').prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"Date\"] = __js__('Date'),__js__('Date')));\n\t\t\t__feature__(\"js.Boot.isClass\",__js__('Date').__name__ = [\"Date\"]);\n\t\t});\n\t\t__feature__(\"Int.*\",{\n\t\t\tvar Int = __feature__(\"Type.resolveClass\", $hxClasses[\"Int\"] = { __name__ : [\"Int\"] }, { __name__ : [\"Int\"] });\n\t\t});\n\t\t__feature__(\"Dynamic.*\",{\n\t\t\tvar Dynamic = __feature__(\"Type.resolveClass\", $hxClasses[\"Dynamic\"] = { __name__ : [\"Dynamic\"] }, { __name__ : [\"Dynamic\"] });\n\t\t});\n\t\t__feature__(\"Float.*\",{\n\t\t\tvar Float = __feature__(\"Type.resolveClass\", $hxClasses[\"Float\"] = __js__(\"Number\"), __js__(\"Number\"));\n\t\t\tFloat.__name__ = [\"Float\"];\n\t\t});\n\t\t__feature__(\"Bool.*\",{\n\t\t\tvar Bool = __feature__(\"Type.resolveEnum\",$hxClasses[\"Bool\"] = __js__(\"Boolean\"), __js__(\"Boolean\"));\n\t\t\tBool.__ename__ = [\"Bool\"];\n\t\t});\n\t\t__feature__(\"Class.*\",{\n\t\t\tvar Class = __feature__(\"Type.resolveClass\", $hxClasses[\"Class\"] = { __name__ : [\"Class\"] }, { __name__ : [\"Class\"] });\n\t\t});\n\t\t__feature__(\"Enum.*\",{\n\t\t\tvar Enum = {};\n\t\t});\n\t\t__feature__(\"Void.*\",{\n\t\t\tvar Void = __feature__(\"Type.resolveEnum\", $hxClasses[\"Void\"] = { __ename__ : [\"Void\"] }, { __ename__ : [\"Void\"] });\n\t\t});\n\n#if !js_es5\n\t\t__feature__(\"Array.map\",\n\t\t\tif( Array.prototype.map == null )\n\t\t\t\tArray.prototype.map = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length )\n\t\t\t\t\t\ta[i] = f(__this__[i]);\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n\t\t__feature__(\"Array.filter\",\n\t\t\tif( Array.prototype.filter == null )\n\t\t\t\tArray.prototype.filter = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length ) {\n\t\t\t\t\t\tvar e = __this__[i];\n\t\t\t\t\t\tif( f(e) ) a.push(e);\n\t\t\t\t\t}\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n#end\n\t}\n\n}\n","package bunnymark;\n\nimport pixi.core.textures.Texture;\nimport pixi.core.sprites.Sprite;\n\nclass Bunny extends Sprite {\n\n\tpublic var speedX(default, default):Float;\n\tpublic var speedY(default, default):Float;\n\tpublic var scaleSpeed(default, default):Float;\n\tpublic var rotationSpeed(default, default):Float;\n\n\tpublic function new(texture:Texture) {\n\t\tsuper(texture);\n\t}\n}","package pixi.plugins.app;\n\nimport pixi.core.renderers.webgl.WebGLRenderer;\nimport pixi.core.renderers.canvas.CanvasRenderer;\nimport pixi.core.renderers.Detector;\nimport pixi.core.display.Container;\nimport js.html.Event;\nimport js.html.Element;\nimport js.html.CanvasElement;\nimport js.Browser;\n\n/**\n * Pixi Boilerplate Helper class that can be used by any application\n * @author Adi Reddy Mora\n * http://adireddy.github.io\n * @license MIT\n * @copyright 2015\n */\nclass Application {\n\n\t/**\n * Sets the pixel ratio of the application.\n * default - 1\n */\n\tpublic var pixelRatio:Float;\n\n\t/**\n\t * Default frame rate is 60 FPS and this can be set to true to get 30 FPS.\n\t * default - false\n\t */\n\tpublic var skipFrame(default, set):Bool;\n\n\t/**\n\t * Default frame rate is 60 FPS and this can be set to anything between 1 - 60.\n\t * default - 60\n\t */\n\tpublic var fps(default, set):Int;\n\n\t/**\n\t * Width of the application.\n\t * default - Browser.window.innerWidth\n\t */\n\tpublic var width:Float;\n\n\t/**\n\t * Height of the application.\n\t * default - Browser.window.innerHeight\n\t */\n\tpublic var height:Float;\n\n\t/**\n\t * Position of canvas element\n\t * default - static\n\t */\n\tpublic var position:String;\n\n\t/**\n\t * Renderer transparency property.\n\t * default - false\n\t */\n\tpublic var transparent:Bool;\n\n\t/**\n\t * Graphics antialias property.\n\t * default - false\n\t */\n\tpublic var antialias:Bool;\n\n\t/**\n\t * Force FXAA shader antialias instead of native (faster).\n\t * default - false\n\t */\n\tpublic var forceFXAA:Bool;\n\n\t/**\n\t * Force round pixels.\n\t * default - false\n\t */\n\tpublic var roundPixels:Bool;\n\n\t/**\n\t * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.\n * If the scene is transparent Pixi will use clearRect to clear the canvas every frame.\n * Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.\n\t * default - true\n\t */\n\tpublic var clearBeforeRender:Bool;\n\n\t/**\n\t * enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context\n\t * default - false\n\t */\n\tpublic var preserveDrawingBuffer:Bool;\n\n\t/**\n\t * Whether you want to resize the canvas and renderer on browser resize.\n\t * Should be set to false when custom width and height are used for the application.\n\t * default - true\n\t */\n\tpublic var autoResize:Bool;\n\n\t/**\n\t * Sets the background color of the stage.\n\t * default - 0xFFFFFF\n\t */\n\tpublic var backgroundColor:Int;\n\n\t/**\n\t * Update listener \tfunction\n\t */\n\tpublic var onUpdate:Float -> Void;\n\n\t/**\n\t * Window resize listener \tfunction\n\t */\n\tpublic var onResize:Void -> Void;\n\n\t/**\n\t * Canvas Element\n\t * Read-only\n\t */\n\tpublic var canvas(default, null):CanvasElement;\n\n\t/**\n\t * Renderer\n\t * Read-only\n\t */\n\tpublic var renderer(default, null):Dynamic;\n\n\t/**\n\t * Global Container.\n\t * Read-only\n\t */\n\tpublic var stage(default, null):Container;\n\n\tpublic static inline var AUTO:String = \"auto\";\n\tpublic static inline var RECOMMENDED:String = \"recommended\";\n\tpublic static inline var CANVAS:String = \"canvas\";\n\tpublic static inline var WEBGL:String = \"webgl\";\n\n\tvar _frameCount:Int;\n\tvar _animationFrameId:Null;\n\n\tpublic function new() {\n\t\t_setDefaultValues();\n\t}\n\n\tfunction set_fps(val:Int):Int {\n\t\t_frameCount = 0;\n\t\treturn fps = (val >= 1 && val < 60) ? Std.int(val) : 60;\n\t}\n\n\tfunction set_skipFrame(val:Bool):Bool {\n\t\tif (val) {\n\t\t\ttrace(\"pixi.plugins.app.Application > Deprecated: skipFrame - use fps property and set it to 30 instead\");\n\t\t\tfps = 30;\n\t\t}\n\t\treturn skipFrame = val;\n\t}\n\n\tinline function _setDefaultValues() {\n\t\t_animationFrameId = null;\n\t\tpixelRatio = 1;\n\t\tskipFrame = false;\n\t\tautoResize = true;\n\t\ttransparent = false;\n\t\tantialias = false;\n\t\tforceFXAA = false;\n\t\troundPixels = false;\n\t\tclearBeforeRender = true;\n\t\tpreserveDrawingBuffer = false;\n\t\tbackgroundColor = 0xFFFFFF;\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tposition = \"static\";\n\t\tfps = 60;\n\t}\n\n\t/**\n\t * Starts pixi application setup using the properties set or default values\n\t * @param [rendererType] - Renderer type to use AUTO (default) | CANVAS | WEBGL\n\t * @param [stats] - Enable/disable stats for the application.\n\t * Note that stats.js is not part of pixi so don't forget to include it you html page\n\t * Can be found in libs folder. \"libs/stats.min.js\" \n\t * @param [parentDom] - By default canvas will be appended to body or it can be appended to custom element if passed\n\t */\n\n\tpublic function start(?rendererType:String = \"auto\", ?parentDom:Element, ?canvasElement:CanvasElement) {\n\t\tif (canvasElement == null) {\n\t\t\tcanvas = Browser.document.createCanvasElement();\n\t\t\tcanvas.style.width = width + \"px\";\n\t\t\tcanvas.style.height = height + \"px\";\n\t\t\tcanvas.style.position = position;\n\t\t}\n\t\telse canvas = canvasElement;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(canvas);\n\t\telse parentDom.appendChild(canvas);\n\n\t\tstage = new Container();\n\n\t\tvar renderingOptions:RenderingOptions = {};\n\t\trenderingOptions.view = canvas;\n\t\trenderingOptions.backgroundColor = backgroundColor;\n\t\trenderingOptions.resolution = pixelRatio;\n\t\trenderingOptions.antialias = antialias;\n\t\trenderingOptions.forceFXAA = forceFXAA;\n\t\trenderingOptions.autoResize = autoResize;\n\t\trenderingOptions.transparent = transparent;\n\t\trenderingOptions.clearBeforeRender = clearBeforeRender;\n\t\trenderingOptions.preserveDrawingBuffer = preserveDrawingBuffer;\n\n\t\tif (rendererType == AUTO) renderer = Detector.autoDetectRenderer(width, height, renderingOptions);\n\t\telse if (rendererType == CANVAS) renderer = new CanvasRenderer(width, height, renderingOptions);\n\t\telse renderer = new WebGLRenderer(width, height, renderingOptions);\n\n\t\tif (roundPixels) renderer.roundPixels = true;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(renderer.view);\n\t\telse parentDom.appendChild(renderer.view);\n\t\tresumeRendering();\n\t\t#if stats addStats(); #end\n\t}\n\n\tpublic function pauseRendering() {\n\t\tBrowser.window.onresize = null;\n\t\tif (_animationFrameId != null) {\n\t\t\tBrowser.window.cancelAnimationFrame(_animationFrameId);\n\t\t\t_animationFrameId = null;\n\t\t}\n\t}\n\n\tpublic function resumeRendering() {\n\t\tif (autoResize) Browser.window.onresize = _onWindowResize;\n\t\tif (_animationFrameId == null) _animationFrameId = Browser.window.requestAnimationFrame(_onRequestAnimationFrame);\n\t}\n\n\t@:noCompletion function _onWindowResize(event:Event) {\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\trenderer.resize(width, height);\n\t\tcanvas.style.width = width + \"px\";\n\t\tcanvas.style.height = height + \"px\";\n\n\t\tif (onResize != null) onResize();\n\t}\n\n\t@:noCompletion function _onRequestAnimationFrame(elapsedTime:Float) {\n\t\t_frameCount++;\n\t\tif (_frameCount == Std.int(60 / fps)) {\n\t\t\t_frameCount = 0;\n\t\t\tif (onUpdate != null) onUpdate(elapsedTime);\n\t\t\trenderer.render(stage);\n\t\t}\n\t\t_animationFrameId = Browser.window.requestAnimationFrame(_onRequestAnimationFrame);\n\t}\n\n\tpublic function addStats() {\n\t\tif (untyped __js__(\"window\").Perf != null) {\n\t\t\tnew Perf().addInfo([\"UNKNOWN\", \"WEBGL\", \"CANVAS\"][renderer.type] + \" - \" + pixelRatio);\n\t\t}\n\t}\n}","package bunnymark;\n\nimport pixi.particles.ParticleContainer;\nimport pixi.core.math.shapes.Rectangle;\nimport js.html.DivElement;\nimport js.Browser;\nimport pixi.core.display.Container;\nimport pixi.core.textures.Texture;\nimport pixi.plugins.app.Application;\n\nclass Main extends Application {\n\n\tvar wabbitTexture:Texture;\n\n\tvar bunnys:Array = [];\n\tvar bunnyTextures:Array = [];\n\tvar gravity:Float = 0.5;\n\n\tvar maxX:Float;\n\tvar minX:Float = 0;\n\tvar maxY:Float;\n\tvar minY:Float = 0;\n\n\tvar startBunnyCount:Int = 2;\n\tvar isAdding:Bool = false;\n\tvar count:Int = 0;\n\tvar container:ParticleContainer;\n\n\tvar amount:Int = 100;\n\tvar bunnyType:Int;\n\tvar currentTexture:Texture;\n\tvar counter:DivElement;\n\n\tpublic function new() {\n\t\tsuper();\n\t\t_init();\n\t}\n\n\tfunction _init() {\n\t\tposition = \"fixed\";\n\t\tbackgroundColor = 0x8BDDCE;\n\t\tonUpdate = _onUpdate;\n\t\tonResize = _onResize;\n\t\tfps = 50;\n\t\tsuper.start();\n\t\t_setup();\n\t}\n\n\tfunction _setup() {\n\t\trenderer.view.style.transform = \"translatez(0)\";\n\t\tmaxX = Browser.window.innerWidth;\n\t\tmaxY = Browser.window.innerHeight;\n\n\t\tcounter = Browser.document.createDivElement();\n\t\tcounter.style.position = \"absolute\";\n\t\tcounter.style.top = \"0px\";\n\t\tcounter.style.width = \"76px\";\n\t\tcounter.style.background = \"#CCCCC\";\n\t\tcounter.style.backgroundColor = \"#105CB6\";\n\t\tcounter.style.fontFamily = \"Helvetica,Arial\";\n\t\tcounter.style.padding = \"2px\";\n\t\tcounter.style.color = \"#0FF\";\n\t\tcounter.style.fontSize = \"9px\";\n\t\tcounter.style.fontWeight = \"bold\";\n\t\tcounter.style.textAlign = \"center\";\n\t\tcounter.className = \"counter\";\n\t\tBrowser.document.body.appendChild(counter);\n\n\t\tcount = startBunnyCount;\n\t\tcounter.innerHTML = count + \" BUNNIES\";\n\n\t\tcontainer = new ParticleContainer(200000, [false, true, false, false, false]);\n\t\tstage.addChild(container);\n\n\t\twabbitTexture = Texture.fromImage(\"assets/bunnymark/bunnys.png\");\n\n\t\tvar bunny1 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 47, 26, 37));\n\t\tvar bunny2 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 86, 26, 37));\n\t\tvar bunny3 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 125, 26, 37));\n\t\tvar bunny4 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 164, 26, 37));\n\t\tvar bunny5 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 2, 26, 37));\n\n\t\tbunnyTextures = [bunny1, bunny2, bunny3, bunny4, bunny5];\n\t\tbunnyType = 1;\n\t\tcurrentTexture = bunnyTextures[bunnyType];\n\n\t\tfor (i in 0 ... startBunnyCount) {\n\t\t\tvar bunny = new Bunny(currentTexture);\n\t\t\tbunny.speedX = Math.random() * 5;\n\t\t\tbunny.speedY = (Math.random() * 5) - 3;\n\n\t\t\tbunny.anchor.x = 0.5;\n\t\t\tbunny.anchor.y = 1;\n\n\t\t\tbunnys.push(bunny);\n\t\t\tcontainer.addChild(bunny);\n\t\t}\n\n\t\trenderer.view.onmousedown = onTouchStart;\n\t\trenderer.view.onmouseup = onTouchEnd;\n\n\t\tBrowser.document.addEventListener(\"touchstart\", onTouchStart, true);\n\t\tBrowser.document.addEventListener(\"touchend\", onTouchEnd, true);\n\t}\n\n\tfunction onTouchStart(event) {\n\t\tisAdding = true;\n\t}\n\n\tfunction onTouchEnd(event) {\n\t\tbunnyType++;\n\t\tbunnyType %= 5;\n\t\tcurrentTexture = bunnyTextures[bunnyType];\n\t\tisAdding = false;\n\t}\n\n\tfunction _onUpdate(elapsedTime:Float) {\n\t\tif (isAdding) {\n\t\t\tif (count < 200000) {\n\t\t\t\tfor (i in 0 ... amount) {\n\t\t\t\t\tvar bunny = new Bunny(currentTexture);\n\t\t\t\t\tbunny.speedX = Math.random() * 5;\n\t\t\t\t\tbunny.speedY = (Math.random() * 5) - 3;\n\t\t\t\t\tbunny.anchor.y = 1;\n\t\t\t\t\tbunnys.push(bunny);\n\t\t\t\t\tbunny.scale.set(0.5 + Math.random() * 0.5, 0.5 + Math.random() * 0.5);\n\t\t\t\t\tbunny.rotation = (Math.random() - 0.5);\n\t\t\t\t\tvar random = Std.random(container.children.length - 2);\n\t\t\t\t\tcontainer.addChild(bunny);\n\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcounter.innerHTML = count + \" BUNNIES\";\n\t\t}\n\n\t\tfor (i in 0 ... bunnys.length) {\n\t\t\tvar bunny = bunnys[i];\n\n\t\t\tbunny.position.x += bunny.speedX;\n\t\t\tbunny.position.y += bunny.speedY;\n\t\t\tbunny.speedY += gravity;\n\n\t\t\tif (bunny.position.x > maxX) {\n\t\t\t\tbunny.speedX *= -1;\n\t\t\t\tbunny.position.x = maxX;\n\t\t\t}\n\t\t\telse if (bunny.position.x < minX) {\n\t\t\t\tbunny.speedX *= -1;\n\t\t\t\tbunny.position.x = minX;\n\t\t\t}\n\n\t\t\tif (bunny.position.y > maxY) {\n\t\t\t\tbunny.speedY *= -0.85;\n\t\t\t\tbunny.position.y = maxY;\n\t\t\t\tif (Math.random() > 0.5) bunny.speedY -= Math.random() * 6;\n\t\t\t}\n\t\t\telse if (bunny.position.y < minY) {\n\t\t\t\tbunny.speedY = 0;\n\t\t\t\tbunny.position.y = minY;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction _onResize() {\n\t\tmaxX = Browser.window.innerWidth;\n\t\tmaxY = Browser.window.innerHeight;\n\n\t\tcounter.style.top = \"1px\";\n\t\tcounter.style.left = \"1px\";\n\t}\n\n\tstatic function main() {\n\t\tnew Main();\n\t}\n}"],
+"sourcesContent":["import js.html.Performance;\nimport js.html.DivElement;\nimport js.Browser;\n\n@:expose class Perf {\n\n\tpublic static var MEASUREMENT_INTERVAL:Int = 1000;\n\n\tpublic static var FONT_FAMILY:String = \"Helvetica,Arial\";\n\n\tpublic static var FPS_BG_CLR:String = \"#00FF00\";\n\tpublic static var FPS_WARN_BG_CLR:String = \"#FF8000\";\n\tpublic static var FPS_PROB_BG_CLR:String = \"#FF0000\";\n\n\tpublic static var MS_BG_CLR:String = \"#FFFF00\";\n\tpublic static var MEM_BG_CLR:String = \"#086A87\";\n\tpublic static var INFO_BG_CLR:String = \"#00FFFF\";\n\tpublic static var FPS_TXT_CLR:String = \"#000000\";\n\tpublic static var MS_TXT_CLR:String = \"#000000\";\n\tpublic static var MEM_TXT_CLR:String = \"#FFFFFF\";\n\tpublic static var INFO_TXT_CLR:String = \"#000000\";\n\n\tpublic static var TOP_LEFT:String = \"TL\";\n\tpublic static var TOP_RIGHT:String = \"TR\";\n\tpublic static var BOTTOM_LEFT:String = \"BL\";\n\tpublic static var BOTTOM_RIGHT:String = \"BR\";\n\n\tstatic var DELAY_TIME:Int = 4000;\n\n\tpublic var fps:DivElement;\n\tpublic var ms:DivElement;\n\tpublic var memory:DivElement;\n\tpublic var info:DivElement;\n\n\tpublic var lowFps:Float;\n\tpublic var avgFps:Float;\n\tpublic var currentFps:Float;\n\tpublic var currentMs:Float;\n\tpublic var currentMem:String;\n\n\tvar _time:Float;\n\tvar _startTime:Float;\n\tvar _prevTime:Float;\n\tvar _ticks:Int;\n\tvar _fpsMin:Float;\n\tvar _fpsMax:Float;\n\tvar _memCheck:Bool;\n\tvar _pos:String;\n\tvar _offset:Float;\n\tvar _measureCount:Int;\n\tvar _totalFps:Float;\n\n\tvar _perfObj:Performance;\n\tvar _memoryObj:Memory;\n\tvar _raf:Int;\n\n\tvar RAF:Dynamic;\n\tvar CAF:Dynamic;\n\n\tpublic function new(?pos = \"TR\", ?offset:Float = 0) {\n\t\t_perfObj = Browser.window.performance;\n\t\tif (Reflect.field(_perfObj, \"memory\") != null) _memoryObj = Reflect.field(_perfObj, \"memory\");\n\t\t_memCheck = (_perfObj != null && _memoryObj != null && _memoryObj.totalJSHeapSize > 0);\n\n\t\t_pos = pos;\n\t\t_offset = offset;\n\n\t\t_init();\n\t\t_createFpsDom();\n\t\t_createMsDom();\n\t\tif (_memCheck) _createMemoryDom();\n\n\t\tif (Browser.window.requestAnimationFrame != null) RAF = Browser.window.requestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozRequestAnimationFrame != null) RAF = untyped __js__(\"window\").mozRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitRequestAnimationFrame != null) RAF = untyped __js__(\"window\").webkitRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msRequestAnimationFrame != null) RAF = untyped __js__(\"window\").msRequestAnimationFrame;\n\n\t\tif (Browser.window.cancelAnimationFrame != null) CAF = Browser.window.cancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozCancelAnimationFrame != null) CAF = untyped __js__(\"window\").mozCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitCancelAnimationFrame != null) CAF = untyped __js__(\"window\").webkitCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msCancelAnimationFrame != null) CAF = untyped __js__(\"window\").msCancelAnimationFrame;\n\n\t\tif (RAF != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tinline function _init() {\n\t\tcurrentFps = 60;\n\t\tcurrentMs = 0;\n\t\tcurrentMem = \"0\";\n\n\t\tlowFps = 60;\n\t\tavgFps = 60;\n\n\t\t_measureCount = 0;\n\t\t_totalFps = 0;\n\t\t_time = 0;\n\t\t_ticks = 0;\n\t\t_fpsMin = 60;\n\t\t_fpsMax = 60;\n\t\t_startTime = _now();\n\t\t_prevTime = -MEASUREMENT_INTERVAL;\n\t}\n\n\tinline function _now():Float {\n\t\treturn (_perfObj != null && _perfObj.now != null) ? _perfObj.now() : Date.now().getTime();\n\t}\n\n\tfunction _tick(val:Float) {\n\t\tvar time = _now();\n\t\t_ticks++;\n\n\t\tif (_raf != null && time > _prevTime + MEASUREMENT_INTERVAL) {\n\t\t\tcurrentMs = Math.round(time - _startTime);\n\t\t\tms.innerHTML = \"MS: \" + currentMs;\n\n\t\t\tcurrentFps = Math.round((_ticks * 1000) / (time - _prevTime));\n\t\t\tif (currentFps > 0 && val > DELAY_TIME) {\n\t\t\t\t_measureCount++;\n\t\t\t\t_totalFps += currentFps;\n\t\t\t\tlowFps = _fpsMin = Math.min(_fpsMin, currentFps);\n\t\t\t\t_fpsMax = Math.max(_fpsMax, currentFps);\n\t\t\t\tavgFps = Math.round(_totalFps / _measureCount);\n\t\t\t}\n\n\t\t\tfps.innerHTML = \"FPS: \" + currentFps + \" (\" + _fpsMin + \"-\" + _fpsMax + \")\";\n\n\t\t\tif (currentFps >= 30) fps.style.backgroundColor = FPS_BG_CLR;\n\t\t\telse if (currentFps >= 15) fps.style.backgroundColor = FPS_WARN_BG_CLR;\n\t\t\telse fps.style.backgroundColor = FPS_PROB_BG_CLR;\n\n\t\t\t_prevTime = time;\n\t\t\t_ticks = 0;\n\n\t\t\tif (_memCheck) {\n\t\t\t\tcurrentMem = _getFormattedSize(_memoryObj.usedJSHeapSize, 2);\n\t\t\t\tmemory.innerHTML = \"MEM: \" + currentMem;\n\t\t\t}\n\t\t}\n\t\t_startTime = time;\n\n\t\tif (_raf != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tfunction _createDiv(id:String, ?top:Float = 0):DivElement {\n\t\tvar div:DivElement = Browser.document.createDivElement();\n\t\tdiv.id = id;\n\t\tdiv.className = id;\n\t\tdiv.style.position = \"absolute\";\n\n\t\tswitch (_pos) {\n\t\t\tcase \"TL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"TR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"BL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t\tcase \"BR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t}\n\n\t\tdiv.style.width = \"80px\";\n\t\tdiv.style.height = \"12px\";\n\t\tdiv.style.lineHeight = \"12px\";\n\t\tdiv.style.padding = \"2px\";\n\t\tdiv.style.fontFamily = FONT_FAMILY;\n\t\tdiv.style.fontSize = \"9px\";\n\t\tdiv.style.fontWeight = \"bold\";\n\t\tdiv.style.textAlign = \"center\";\n\t\tBrowser.document.body.appendChild(div);\n\t\treturn div;\n\t}\n\n\tfunction _createFpsDom() {\n\t\tfps = _createDiv(\"fps\");\n\t\tfps.style.backgroundColor = FPS_BG_CLR;\n\t\tfps.style.zIndex = \"995\";\n\t\tfps.style.color = FPS_TXT_CLR;\n\t\tfps.innerHTML = \"FPS: 0\";\n\t}\n\n\tfunction _createMsDom() {\n\t\tms = _createDiv(\"ms\", 16);\n\t\tms.style.backgroundColor = MS_BG_CLR;\n\t\tms.style.zIndex = \"996\";\n\t\tms.style.color = MS_TXT_CLR;\n\t\tms.innerHTML = \"MS: 0\";\n\t}\n\n\tfunction _createMemoryDom() {\n\t\tmemory = _createDiv(\"memory\", 32);\n\t\tmemory.style.backgroundColor = MEM_BG_CLR;\n\t\tmemory.style.color = MEM_TXT_CLR;\n\t\tmemory.style.zIndex = \"997\";\n\t\tmemory.innerHTML = \"MEM: 0\";\n\t}\n\n\tfunction _getFormattedSize(bytes:Float, ?frac:Int = 0):String {\n\t\tvar sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n\t\tif (bytes == 0) return \"0\";\n\t\tvar precision = Math.pow(10, frac);\n\t\tvar i = Math.floor(Math.log(bytes) / Math.log(1024));\n\t\treturn Math.round(bytes * precision / Math.pow(1024, i)) / precision + \" \" + sizes[i];\n\t}\n\n\tpublic function addInfo(val:String) {\n\t\tinfo = _createDiv(\"info\", (_memCheck) ? 48 : 32);\n\t\tinfo.style.backgroundColor = INFO_BG_CLR;\n\t\tinfo.style.color = INFO_TXT_CLR;\n\t\tinfo.style.zIndex = \"998\";\n\t\tinfo.innerHTML = val;\n\t}\n\n\tpublic function clearInfo() {\n\t\tif (info != null) {\n\t\t\tBrowser.document.body.removeChild(info);\n\t\t\tinfo = null;\n\t\t}\n\t}\n\n\tpublic function destroy() {\n\t\t_cancelRAF();\n\t\t_perfObj = null;\n\t\t_memoryObj = null;\n\t\tif (fps != null) {\n\t\t\tBrowser.document.body.removeChild(fps);\n\t\t\tfps = null;\n\t\t}\n\t\tif (ms != null) {\n\t\t\tBrowser.document.body.removeChild(ms);\n\t\t\tms = null;\n\t\t}\n\t\tif (memory != null) {\n\t\t\tBrowser.document.body.removeChild(memory);\n\t\t\tmemory = null;\n\t\t}\n\t\tclearInfo();\n\t\t_init();\n\t}\n\n\tinline function _cancelRAF() {\n\t\tReflect.callMethod(Browser.window, CAF, [_raf]);\n\t\t_raf = null;\n\t}\n}\n\ntypedef Memory = {\n\tvar usedJSHeapSize:Float;\n\tvar totalJSHeapSize:Float;\n\tvar jsHeapSizeLimit:Float;\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class Reflect {\n\n\tpublic inline static function hasField( o : Dynamic, field : String ) : Bool {\n\t\treturn untyped __js__('Object').prototype.hasOwnProperty.call(o, field);\n\t}\n\n\tpublic static function field( o : Dynamic, field : String ) : Dynamic {\n\t\ttry return untyped o[field] catch( e : Dynamic ) return null;\n\t}\n\n\tpublic inline static function setField( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\to[field] = value;\n\t}\n\n\tpublic static inline function getProperty( o : Dynamic, field : String ) : Dynamic untyped {\n\t\tvar tmp;\n\t\treturn if( o == null ) __define_feature__(\"Reflect.getProperty\",null) else if( o.__properties__ && (tmp=o.__properties__[\"get_\"+field]) ) o[tmp]() else o[field];\n\t}\n\n\tpublic static inline function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\tvar tmp;\n\t\tif( o.__properties__ && (tmp=o.__properties__[\"set_\"+field]) ) o[tmp](value) else o[field] = __define_feature__(\"Reflect.setProperty\",value);\n\t}\n\n\tpublic inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array ) : Dynamic untyped {\n\t\treturn func.apply(o,args);\n\t}\n\n\tpublic static function fields( o : Dynamic ) : Array {\n\t\tvar a = [];\n\t\tif (o != null) untyped {\n\t\t\tvar hasOwnProperty = __js__('Object').prototype.hasOwnProperty;\n\t\t\t__js__(\"for( var f in o ) {\");\n\t\t\tif( f != \"__id__\" && f != \"hx__closures__\" && hasOwnProperty.call(o, f) ) a.push(f);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static function isFunction( f : Dynamic ) : Bool untyped {\n\t\treturn __js__(\"typeof(f)\") == \"function\" && !(js.Boot.isClass(f) || js.Boot.isEnum(f));\n\t}\n\n\tpublic static function compare( a : T, b : T ) : Int {\n\t\treturn ( a == b ) ? 0 : (((cast a) > (cast b)) ? 1 : -1);\n\t}\n\n\tpublic static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool {\n\t\tif( f1 == f2 )\n\t\t\treturn true;\n\t\tif( !isFunction(f1) || !isFunction(f2) )\n\t\t\treturn false;\n\t\treturn f1.scope == f2.scope && f1.method == f2.method && f1.method != null;\n\t}\n\n\tpublic static function isObject( v : Dynamic ) : Bool untyped {\n\t\tif( v == null )\n\t\t\treturn false;\n\t\tvar t = __js__(\"typeof(v)\");\n\t\treturn (t == \"string\" || (t == \"object\" && v.__enum__ == null)) || (t == \"function\" && (js.Boot.isClass(v) || js.Boot.isEnum(v)) != null);\n\t}\n\n\tpublic static function isEnumValue( v : Dynamic ) : Bool {\n\t\treturn v != null && v.__enum__ != null;\n\t}\n\n\tpublic static function deleteField( o : Dynamic, field : String ) : Bool untyped {\n\t\tif( !hasField(o,field) ) return false;\n\t\t__js__(\"delete\")(o[field]);\n\t\treturn true;\n\t}\n\n\tpublic static function copy( o : T ) : T {\n\t\tvar o2 : Dynamic = {};\n\t\tfor( f in Reflect.fields(o) )\n\t\t\tReflect.setField(o2,f,Reflect.field(o,f));\n\t\treturn o2;\n\t}\n\n\t@:overload(function( f : Array -> Void ) : Dynamic {})\n\tpublic static function makeVarArgs( f : Array -> Dynamic ) : Dynamic {\n\t\treturn function() {\n\t\t\tvar a = untyped Array.prototype.slice.call(__js__(\"arguments\"));\n\t\t\treturn f(a);\n\t\t};\n\t}\n\n}\n","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport js.Boot;\n\n@:keepInit\n@:coreApi class Std {\n\n\tpublic static inline function is( v : Dynamic, t : Dynamic ) : Bool {\n\t\treturn untyped js.Boot.__instanceof(v,t);\n\t}\n\n\tpublic static inline function instance( value : T, c : Class ) : S {\n\t\treturn untyped __instanceof__(value, c) ? cast value : null;\n\t}\n\n\tpublic static function string( s : Dynamic ) : String {\n\t\treturn untyped js.Boot.__string_rec(s,\"\");\n\t}\n\n\tpublic static inline function int( x : Float ) : Int {\n\t\treturn (cast x) | 0;\n\t}\n\n\tpublic static function parseInt( x : String ) : Null {\n\t\tvar v = untyped __js__(\"parseInt\")(x, 10);\n\t\t// parse again if hexadecimal\n\t\tif( v == 0 && (x.charCodeAt(1) == 'x'.code || x.charCodeAt(1) == 'X'.code) )\n\t\t\tv = untyped __js__(\"parseInt\")(x);\n\t\tif( untyped __js__(\"isNaN\")(v) )\n\t\t\treturn null;\n\t\treturn cast v;\n\t}\n\n\tpublic static inline function parseFloat( x : String ) : Float {\n\t\treturn untyped __js__(\"parseFloat\")(x);\n\t}\n\n\tpublic static function random( x : Int ) : Int {\n\t\treturn untyped x <= 0 ? 0 : Math.floor(Math.random()*x);\n\t}\n\n\tstatic function __init__() : Void untyped {\n\t\t__feature__(\"js.Boot.getClass\",String.prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"String\"] = String,String));\n\t\t__feature__(\"js.Boot.isClass\",String.__name__ = __feature__(\"Type.getClassName\",[\"String\"],true));\n\t\t__feature__(\"Type.resolveClass\",$hxClasses[\"Array\"] = Array);\n\t\t__feature__(\"js.Boot.isClass\",Array.__name__ = __feature__(\"Type.getClassName\",[\"Array\"],true));\n\t\t__feature__(\"Date.*\", {\n\t\t\t__feature__(\"js.Boot.getClass\",__js__('Date').prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"Date\"] = __js__('Date'),__js__('Date')));\n\t\t\t__feature__(\"js.Boot.isClass\",__js__('Date').__name__ = [\"Date\"]);\n\t\t});\n\t\t__feature__(\"Int.*\",{\n\t\t\tvar Int = __feature__(\"Type.resolveClass\", $hxClasses[\"Int\"] = { __name__ : [\"Int\"] }, { __name__ : [\"Int\"] });\n\t\t});\n\t\t__feature__(\"Dynamic.*\",{\n\t\t\tvar Dynamic = __feature__(\"Type.resolveClass\", $hxClasses[\"Dynamic\"] = { __name__ : [\"Dynamic\"] }, { __name__ : [\"Dynamic\"] });\n\t\t});\n\t\t__feature__(\"Float.*\",{\n\t\t\tvar Float = __feature__(\"Type.resolveClass\", $hxClasses[\"Float\"] = __js__(\"Number\"), __js__(\"Number\"));\n\t\t\tFloat.__name__ = [\"Float\"];\n\t\t});\n\t\t__feature__(\"Bool.*\",{\n\t\t\tvar Bool = __feature__(\"Type.resolveEnum\",$hxClasses[\"Bool\"] = __js__(\"Boolean\"), __js__(\"Boolean\"));\n\t\t\tBool.__ename__ = [\"Bool\"];\n\t\t});\n\t\t__feature__(\"Class.*\",{\n\t\t\tvar Class = __feature__(\"Type.resolveClass\", $hxClasses[\"Class\"] = { __name__ : [\"Class\"] }, { __name__ : [\"Class\"] });\n\t\t});\n\t\t__feature__(\"Enum.*\",{\n\t\t\tvar Enum = {};\n\t\t});\n\t\t__feature__(\"Void.*\",{\n\t\t\tvar Void = __feature__(\"Type.resolveEnum\", $hxClasses[\"Void\"] = { __ename__ : [\"Void\"] }, { __ename__ : [\"Void\"] });\n\t\t});\n\n#if !js_es5\n\t\t__feature__(\"Array.map\",\n\t\t\tif( Array.prototype.map == null )\n\t\t\t\tArray.prototype.map = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length )\n\t\t\t\t\t\ta[i] = f(__this__[i]);\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n\t\t__feature__(\"Array.filter\",\n\t\t\tif( Array.prototype.filter == null )\n\t\t\t\tArray.prototype.filter = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length ) {\n\t\t\t\t\t\tvar e = __this__[i];\n\t\t\t\t\t\tif( f(e) ) a.push(e);\n\t\t\t\t\t}\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n#end\n\t}\n\n}\n","package bunnymark;\n\nimport pixi.core.textures.Texture;\nimport pixi.core.sprites.Sprite;\n\nclass Bunny extends Sprite {\n\n\tpublic var speedX(default, default):Float;\n\tpublic var speedY(default, default):Float;\n\tpublic var scaleSpeed(default, default):Float;\n\tpublic var rotationSpeed(default, default):Float;\n\n\tpublic function new(texture:Texture) {\n\t\tsuper(texture);\n\t}\n}","package pixi.plugins.app;\n\nimport pixi.core.renderers.SystemRenderer;\nimport js.html.Event;\nimport pixi.core.RenderOptions;\nimport pixi.core.display.Container;\nimport js.html.Element;\nimport js.html.CanvasElement;\nimport js.Browser;\n\n/**\n * Pixi Boilerplate Helper class that can be used by any application\n * @author Adi Reddy Mora\n * http://adireddy.github.io\n * @license MIT\n * @copyright 2015\n */\nclass Application {\n\n\t/**\n * Sets the pixel ratio of the application.\n * default - 1\n */\n\tpublic var pixelRatio:Float;\n\n\t/**\n\t * Width of the application.\n\t * default - Browser.window.innerWidth\n\t */\n\tpublic var width:Float;\n\n\t/**\n\t * Height of the application.\n\t * default - Browser.window.innerHeight\n\t */\n\tpublic var height:Float;\n\n\t/**\n\t * Position of canvas element\n\t * default - static\n\t */\n\tpublic var position:String;\n\n\t/**\n\t * Renderer transparency property.\n\t * default - false\n\t */\n\tpublic var transparent:Bool;\n\n\t/**\n\t * Graphics antialias property.\n\t * default - false\n\t */\n\tpublic var antialias:Bool;\n\n\t/**\n\t * Force FXAA shader antialias instead of native (faster).\n\t * default - false\n\t */\n\tpublic var forceFXAA:Bool;\n\n\t/**\n\t * Force round pixels.\n\t * default - false\n\t */\n\tpublic var roundPixels:Bool;\n\n\t/**\n\t * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.\n * If the scene is transparent Pixi will use clearRect to clear the canvas every frame.\n * Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.\n\t * default - true\n\t */\n\tpublic var clearBeforeRender:Bool;\n\n\t/**\n\t * enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context\n\t * default - false\n\t */\n\tpublic var preserveDrawingBuffer:Bool;\n\n\t/**\n\t * Whether you want to resize the canvas and renderer on browser resize.\n\t * Should be set to false when custom width and height are used for the application.\n\t * default - true\n\t */\n\tpublic var autoResize:Bool;\n\n\t/**\n\t * Sets the background color of the stage.\n\t * default - 0xFFFFFF\n\t */\n\tpublic var backgroundColor:Int;\n\n\t/**\n\t * Update listener \tfunction\n\t */\n\tpublic var onUpdate:Float -> Void;\n\n\t/**\n\t * Window resize listener \tfunction\n\t */\n\tpublic var onResize:Void -> Void;\n\n\t/**\n\t * Canvas Element\n\t * Read-only\n\t */\n\tpublic var canvas(default, null):CanvasElement;\n\n\t/**\n\t * Renderer\n\t * Read-only\n\t */\n\tpublic var renderer(default, null):SystemRenderer;\n\n\t/**\n\t * Global Container.\n\t * Read-only\n\t */\n\tpublic var stage(default, null):Container;\n\n\t/**\n\t * Pixi Application\n\t * Read-only\n\t */\n\tpublic var app(default, null):pixi.core.Application;\n\n\tpublic static inline var AUTO:String = \"auto\";\n\tpublic static inline var RECOMMENDED:String = \"recommended\";\n\tpublic static inline var CANVAS:String = \"canvas\";\n\tpublic static inline var WEBGL:String = \"webgl\";\n\n\tpublic static inline var POSITION_STATIC:String = \"static\";\n\tpublic static inline var POSITION_ABSOLUTE:String = \"absolute\";\n\tpublic static inline var POSITION_FIXED:String = \"fixed\";\n\tpublic static inline var POSITION_RELATIVE:String = \"relative\";\n\tpublic static inline var POSITION_INITIAL:String = \"initial\";\n\tpublic static inline var POSITION_INHERIT:String = \"inherit\";\n\n\tvar _frameCount:Int;\n\tvar _animationFrameId:Null;\n\n\tpublic function new() {\n\t\t_setDefaultValues();\n\t}\n\n\tinline function _setDefaultValues() {\n\t\t_animationFrameId = null;\n\t\tpixelRatio = 1;\n\t\tautoResize = true;\n\t\ttransparent = false;\n\t\tantialias = false;\n\t\tforceFXAA = false;\n\t\troundPixels = false;\n\t\tclearBeforeRender = true;\n\t\tpreserveDrawingBuffer = false;\n\t\tbackgroundColor = 0xFFFFFF;\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tposition = \"static\";\n\t}\n\n\t/**\n\t * Starts pixi application setup using the properties set or default values\n\t * @param [rendererType] - Renderer type to use AUTO (default) | CANVAS | WEBGL\n\t * @param [stats] - Enable/disable stats for the application.\n\t * Note that stats.js is not part of pixi so don't forget to include it you html page\n\t * Can be found in libs folder. \"libs/stats.min.js\" \n\t * @param [parentDom] - By default canvas will be appended to body or it can be appended to custom element if passed\n\t */\n\n\tpublic function start(?rendererType:String = \"auto\", ?parentDom:Element, ?canvasElement:CanvasElement) {\n\t\tif (canvasElement == null) {\n\t\t\tcanvas = Browser.document.createCanvasElement();\n\t\t\tcanvas.style.width = width + \"px\";\n\t\t\tcanvas.style.height = height + \"px\";\n\t\t\tcanvas.style.position = position;\n\t\t}\n\t\telse canvas = canvasElement;\n\n\t\tif (autoResize) Browser.window.onresize = _onWindowResize;\n\n\t\tvar renderingOptions:RenderOptions = {};\n\t\trenderingOptions.view = canvas;\n\t\trenderingOptions.backgroundColor = backgroundColor;\n\t\trenderingOptions.resolution = pixelRatio;\n\t\trenderingOptions.antialias = antialias;\n\t\trenderingOptions.forceFXAA = forceFXAA;\n\t\trenderingOptions.autoResize = autoResize;\n\t\trenderingOptions.transparent = transparent;\n\t\trenderingOptions.clearBeforeRender = clearBeforeRender;\n\t\trenderingOptions.preserveDrawingBuffer = preserveDrawingBuffer;\n\t\trenderingOptions.roundPixels = roundPixels;\n\n\t\tswitch (rendererType) {\n\t\t\tcase CANVAS: app = new pixi.core.Application(width, height, renderingOptions, true);\n\t\t\tdefault: app = new pixi.core.Application(width, height, renderingOptions);\n\t\t}\n\n\t\tstage = app.stage;\n\t\trenderer = app.renderer;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(app.view);\n\t\telse parentDom.appendChild(app.view);\n\n\t\tapp.ticker.add(_onRequestAnimationFrame);\n\n\t\t#if stats addStats(); #end\n\t}\n\n\tpublic function pauseRendering() {\n\t\tapp.stop();\n\t}\n\n\tpublic function resumeRendering() {\n\t\tapp.start();\n\t}\n\n\t@:noCompletion function _onWindowResize(event:Event) {\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tapp.renderer.resize(width, height);\n\t\tcanvas.style.width = width + \"px\";\n\t\tcanvas.style.height = height + \"px\";\n\n\t\tif (onResize != null) onResize();\n\t}\n\n\t@:noCompletion function _onRequestAnimationFrame() {\n\t\tif (onUpdate != null) onUpdate(app.ticker.deltaTime);\n\t}\n\n\tpublic function addStats() {\n\t\tif (untyped __js__(\"window\").Perf != null) {\n\t\t\tnew Perf().addInfo([\"UNKNOWN\", \"WEBGL\", \"CANVAS\"][app.renderer.type] + \" - \" + pixelRatio);\n\t\t}\n\t}\n}","package bunnymark;\n\nimport pixi.particles.ParticleContainer;\nimport pixi.core.math.shapes.Rectangle;\nimport js.html.DivElement;\nimport js.Browser;\nimport pixi.core.textures.Texture;\nimport pixi.plugins.app.Application;\n\nclass Main extends Application {\n\n\tvar wabbitTexture:Texture;\n\n\tvar bunnys:Array = [];\n\tvar bunnyTextures:Array = [];\n\tvar gravity:Float = 0.5;\n\n\tvar maxX:Float;\n\tvar minX:Float = 0;\n\tvar maxY:Float;\n\tvar minY:Float = 0;\n\n\tvar startBunnyCount:Int = 2;\n\tvar isAdding:Bool = false;\n\tvar count:Int = 0;\n\tvar container:ParticleContainer;\n\n\tvar amount:Int = 100;\n\tvar bunnyType:Int;\n\tvar currentTexture:Texture;\n\tvar counter:DivElement;\n\n\tpublic function new() {\n\t\tsuper();\n\t\t_init();\n\t}\n\n\tfunction _init() {\n\t\tposition = \"fixed\";\n\t\tbackgroundColor = 0x8BDDCE;\n\t\tonUpdate = _onUpdate;\n\t\tonResize = _onResize;\n\t\tautoResize = true;\n\t\tsuper.start();\n\t\t_setup();\n\t}\n\n\tfunction _setup() {\n\t\trenderer.view.style.transform = \"translatez(0)\";\n\t\tmaxX = Browser.window.innerWidth;\n\t\tmaxY = Browser.window.innerHeight;\n\n\t\tcounter = Browser.document.createDivElement();\n\t\tcounter.style.position = \"absolute\";\n\t\tcounter.style.top = \"0px\";\n\t\tcounter.style.width = \"76px\";\n\t\tcounter.style.background = \"#CCCCC\";\n\t\tcounter.style.backgroundColor = \"#105CB6\";\n\t\tcounter.style.fontFamily = \"Helvetica,Arial\";\n\t\tcounter.style.padding = \"2px\";\n\t\tcounter.style.color = \"#0FF\";\n\t\tcounter.style.fontSize = \"9px\";\n\t\tcounter.style.fontWeight = \"bold\";\n\t\tcounter.style.textAlign = \"center\";\n\t\tcounter.className = \"counter\";\n\t\tBrowser.document.body.appendChild(counter);\n\n\t\tcount = startBunnyCount;\n\t\tcounter.innerHTML = count + \" BUNNIES\";\n\n\t\tcontainer = new ParticleContainer(200000, [false, true, false, false, false]);\n\t\tstage.addChild(container);\n\n\t\twabbitTexture = Texture.fromImage(\"assets/bunnymark/bunnys.png\");\n\n\t\tvar bunny1 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 47, 26, 37));\n\t\tvar bunny2 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 86, 26, 37));\n\t\tvar bunny3 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 125, 26, 37));\n\t\tvar bunny4 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 164, 26, 37));\n\t\tvar bunny5 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 2, 26, 37));\n\n\t\tbunnyTextures = [bunny1, bunny2, bunny3, bunny4, bunny5];\n\t\tbunnyType = 1;\n\t\tcurrentTexture = bunnyTextures[bunnyType];\n\n\t\tfor (i in 0 ... startBunnyCount) {\n\t\t\tvar bunny = new Bunny(currentTexture);\n\t\t\tbunny.speedX = Math.random() * 5;\n\t\t\tbunny.speedY = (Math.random() * 5) - 3;\n\n\t\t\tbunny.anchor.x = 0.5;\n\t\t\tbunny.anchor.y = 1;\n\n\t\t\tbunnys.push(bunny);\n\t\t\tcontainer.addChild(bunny);\n\t\t}\n\n\t\trenderer.view.onmousedown = onTouchStart;\n\t\trenderer.view.onmouseup = onTouchEnd;\n\n\t\tBrowser.document.addEventListener(\"touchstart\", onTouchStart, true);\n\t\tBrowser.document.addEventListener(\"touchend\", onTouchEnd, true);\n\t}\n\n\tfunction onTouchStart(event) {\n\t\tisAdding = true;\n\t}\n\n\tfunction onTouchEnd(event) {\n\t\tbunnyType++;\n\t\tbunnyType %= 5;\n\t\tcurrentTexture = bunnyTextures[bunnyType];\n\t\tisAdding = false;\n\t}\n\n\tfunction _onUpdate(elapsedTime:Float) {\n\t\tif (isAdding) {\n\t\t\tif (count < 200000) {\n\t\t\t\tfor (i in 0 ... amount) {\n\t\t\t\t\tvar bunny = new Bunny(currentTexture);\n\t\t\t\t\tbunny.speedX = Math.random() * 5;\n\t\t\t\t\tbunny.speedY = (Math.random() * 5) - 3;\n\t\t\t\t\tbunny.anchor.y = 1;\n\t\t\t\t\tbunnys.push(bunny);\n\t\t\t\t\tbunny.scale.set(0.5 + Math.random() * 0.5, 0.5 + Math.random() * 0.5);\n\t\t\t\t\tbunny.rotation = (Math.random() - 0.5);\n\t\t\t\t\tvar random = Std.random(container.children.length - 2);\n\t\t\t\t\tcontainer.addChild(bunny);\n\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcounter.innerHTML = count + \" BUNNIES\";\n\t\t}\n\n\t\tfor (i in 0 ... bunnys.length) {\n\t\t\tvar bunny = bunnys[i];\n\n\t\t\tbunny.position.x += bunny.speedX;\n\t\t\tbunny.position.y += bunny.speedY;\n\t\t\tbunny.speedY += gravity;\n\n\t\t\tif (bunny.position.x > maxX) {\n\t\t\t\tbunny.speedX *= -1;\n\t\t\t\tbunny.position.x = maxX;\n\t\t\t}\n\t\t\telse if (bunny.position.x < minX) {\n\t\t\t\tbunny.speedX *= -1;\n\t\t\t\tbunny.position.x = minX;\n\t\t\t}\n\n\t\t\tif (bunny.position.y > maxY) {\n\t\t\t\tbunny.speedY *= -0.85;\n\t\t\t\tbunny.position.y = maxY;\n\t\t\t\tif (Math.random() > 0.5) bunny.speedY -= Math.random() * 6;\n\t\t\t}\n\t\t\telse if (bunny.position.y < minY) {\n\t\t\t\tbunny.speedY = 0;\n\t\t\t\tbunny.position.y = minY;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction _onResize() {\n\t\tmaxX = Browser.window.innerWidth;\n\t\tmaxY = Browser.window.innerHeight;\n\n\t\tcounter.style.top = \"1px\";\n\t\tcounter.style.left = \"1px\";\n\t}\n\n\tstatic function main() {\n\t\tnew Main();\n\t}\n}"],
"names":[],
-"mappings":";;;;;;;mBA2DO;;;CACN,EAAW;CACX,CAAI,DAAc,AAAU,GAAa,HAAM,EAAa,FAAc,AAAU;CACpF,EAAY,AAAC,CAAY,AAAQ,AAAc,AAAQ,DAA6B;CAEpF,EAAO;CACP,EAAU;CAEV;;;;;;;;;;;;;CACA;CACA;CACA,CAAI,DAAW;CAEf,CAAI,EAAwC,HAAM,EAAM,GACnD,JAAY,EAA6C,HAAM,EAAc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;KAAxB;KACa,WAAU;KACtB,FAAe,AAAgB;KAC/B,FAAe,AAAC,AAAgB,AAAK;KACrC,FAAiB;KACjB,JAAY;KACZ,JAAgB,EAAM,AAAgB,FAAK,EAAM,AAAgB;KACjE,FAAiB,AAAC,AAAgB;KACrB,JAAW,EAA4B;KACpD,JAAmB;KAEnB;;;GAGF,AAAoB,AAAQ;;EAGnB;EAAM;EAAhB,DAA+B;GAA/B;GACa,FAAO;GAEnB,CAAoB;GACpB,CAAoB;GACpB,CAAgB;GAEhB,DAAI,CAAmB,FAAM;IAC5B,AAAgB;IAChB,DAAmB;MAEf,JAAI,CAAmB,FAAM;IACjC,AAAgB;IAChB,DAAmB;;GAGpB,DAAI,CAAmB,FAAM;IAC5B,AAAgB;IAChB,DAAmB;IACnB,FAAI,CAAgB,FAAK,GAAgB,DAAgB;MAErD,JAAI,CAAmB,FAAM;IACjC,DAAe;IACf,DAAmB;;;;WAKtB,AAAqB;EACpB,CAAO;EACP,CAAO;EAEP,CAAoB;EACpB,CAAqB;;;;;4BLlKuB;mBAEN;kBAED;uBACK;uBACA;iBAEN;kBACC;mBACC;mBACA;kBACD;mBACC;oBACC;kBAOZ;;;;"
}
\ No newline at end of file
diff --git a/samples/_output/colormatrix.js b/samples/_output/colormatrix.js
index 5e8522c0..86cd859f 100644
--- a/samples/_output/colormatrix.js
+++ b/samples/_output/colormatrix.js
@@ -150,7 +150,6 @@ Reflect.callMethod = function(o,func,args) {
var pixi_plugins_app_Application = function() {
this._animationFrameId = null;
this.pixelRatio = 1;
- this.set_skipFrame(false);
this.autoResize = true;
this.transparent = false;
this.antialias = false;
@@ -162,21 +161,9 @@ var pixi_plugins_app_Application = function() {
this.width = window.innerWidth;
this.height = window.innerHeight;
this.position = "static";
- this.set_fps(60);
};
pixi_plugins_app_Application.prototype = {
- set_fps: function(val) {
- this._frameCount = 0;
- return val >= 1 && val < 60?this.fps = val | 0:this.fps = 60;
- }
- ,set_skipFrame: function(val) {
- if(val) {
- console.log("pixi.plugins.app.Application > Deprecated: skipFrame - use fps property and set it to 30 instead");
- this.set_fps(30);
- }
- return this.skipFrame = val;
- }
- ,start: function(rendererType,parentDom,canvasElement) {
+ start: function(rendererType,parentDom,canvasElement) {
if(rendererType == null) rendererType = "auto";
if(canvasElement == null) {
var _this = window.document;
@@ -185,8 +172,7 @@ pixi_plugins_app_Application.prototype = {
this.canvas.style.height = this.height + "px";
this.canvas.style.position = this.position;
} else this.canvas = canvasElement;
- if(parentDom == null) window.document.body.appendChild(this.canvas); else parentDom.appendChild(this.canvas);
- this.stage = new PIXI.Container();
+ if(this.autoResize) window.onresize = $bind(this,this._onWindowResize);
var renderingOptions = { };
renderingOptions.view = this.canvas;
renderingOptions.backgroundColor = this.backgroundColor;
@@ -197,35 +183,33 @@ pixi_plugins_app_Application.prototype = {
renderingOptions.transparent = this.transparent;
renderingOptions.clearBeforeRender = this.clearBeforeRender;
renderingOptions.preserveDrawingBuffer = this.preserveDrawingBuffer;
- if(rendererType == "auto") this.renderer = PIXI.autoDetectRenderer(this.width,this.height,renderingOptions); else if(rendererType == "canvas") this.renderer = new PIXI.CanvasRenderer(this.width,this.height,renderingOptions); else this.renderer = new PIXI.WebGLRenderer(this.width,this.height,renderingOptions);
- if(this.roundPixels) this.renderer.roundPixels = true;
- if(parentDom == null) window.document.body.appendChild(this.renderer.view); else parentDom.appendChild(this.renderer.view);
- this.resumeRendering();
+ renderingOptions.roundPixels = this.roundPixels;
+ if(rendererType != null) switch(rendererType) {
+ case "canvas":
+ this.app = new PIXI.Application(this.width,this.height,renderingOptions,true);
+ break;
+ default:
+ this.app = new PIXI.Application(this.width,this.height,renderingOptions);
+ } else this.app = new PIXI.Application(this.width,this.height,renderingOptions);
+ this.stage = this.app.stage;
+ this.renderer = this.app.renderer;
+ if(parentDom == null) window.document.body.appendChild(this.app.view); else parentDom.appendChild(this.app.view);
+ this.app.ticker.add($bind(this,this._onRequestAnimationFrame));
this.addStats();
}
- ,resumeRendering: function() {
- if(this.autoResize) window.onresize = $bind(this,this._onWindowResize);
- if(this._animationFrameId == null) this._animationFrameId = window.requestAnimationFrame($bind(this,this._onRequestAnimationFrame));
- }
,_onWindowResize: function(event) {
this.width = window.innerWidth;
this.height = window.innerHeight;
- this.renderer.resize(this.width,this.height);
+ this.app.renderer.resize(this.width,this.height);
this.canvas.style.width = this.width + "px";
this.canvas.style.height = this.height + "px";
if(this.onResize != null) this.onResize();
}
- ,_onRequestAnimationFrame: function(elapsedTime) {
- this._frameCount++;
- if(this._frameCount == (60 / this.fps | 0)) {
- this._frameCount = 0;
- if(this.onUpdate != null) this.onUpdate(elapsedTime);
- this.renderer.render(this.stage);
- }
- this._animationFrameId = window.requestAnimationFrame($bind(this,this._onRequestAnimationFrame));
+ ,_onRequestAnimationFrame: function() {
+ if(this.onUpdate != null) this.onUpdate(this.app.ticker.deltaTime);
}
,addStats: function() {
- if(window.Perf != null) new Perf().addInfo(["UNKNOWN","WEBGL","CANVAS"][this.renderer.type] + " - " + this.pixelRatio);
+ if(window.Perf != null) new Perf().addInfo(["UNKNOWN","WEBGL","CANVAS"][this.app.renderer.type] + " - " + this.pixelRatio);
}
};
var filters_colormatrix_Main = function() {
diff --git a/samples/_output/colormatrix.js.map b/samples/_output/colormatrix.js.map
index a24e334c..c9882157 100644
--- a/samples/_output/colormatrix.js.map
+++ b/samples/_output/colormatrix.js.map
@@ -3,7 +3,7 @@
"file":"colormatrix.js",
"sourceRoot":"file:///",
"sources":["/projects/pixi-haxe/.haxelib/perf,js/1,1,8/src/Perf.hx","/usr/local/lib/haxe/std/js/_std/Reflect.hx","/projects/pixi-haxe/src/pixi/plugins/app/Application.hx","/projects/pixi-haxe/samples/filters/colormatrix/Main.hx"],
-"sourcesContent":["import js.html.Performance;\nimport js.html.DivElement;\nimport js.Browser;\n\n@:expose class Perf {\n\n\tpublic static var MEASUREMENT_INTERVAL:Int = 1000;\n\n\tpublic static var FONT_FAMILY:String = \"Helvetica,Arial\";\n\n\tpublic static var FPS_BG_CLR:String = \"#00FF00\";\n\tpublic static var FPS_WARN_BG_CLR:String = \"#FF8000\";\n\tpublic static var FPS_PROB_BG_CLR:String = \"#FF0000\";\n\n\tpublic static var MS_BG_CLR:String = \"#FFFF00\";\n\tpublic static var MEM_BG_CLR:String = \"#086A87\";\n\tpublic static var INFO_BG_CLR:String = \"#00FFFF\";\n\tpublic static var FPS_TXT_CLR:String = \"#000000\";\n\tpublic static var MS_TXT_CLR:String = \"#000000\";\n\tpublic static var MEM_TXT_CLR:String = \"#FFFFFF\";\n\tpublic static var INFO_TXT_CLR:String = \"#000000\";\n\n\tpublic static var TOP_LEFT:String = \"TL\";\n\tpublic static var TOP_RIGHT:String = \"TR\";\n\tpublic static var BOTTOM_LEFT:String = \"BL\";\n\tpublic static var BOTTOM_RIGHT:String = \"BR\";\n\n\tstatic var DELAY_TIME:Int = 4000;\n\n\tpublic var fps:DivElement;\n\tpublic var ms:DivElement;\n\tpublic var memory:DivElement;\n\tpublic var info:DivElement;\n\n\tpublic var lowFps:Float;\n\tpublic var avgFps:Float;\n\tpublic var currentFps:Float;\n\tpublic var currentMs:Float;\n\tpublic var currentMem:String;\n\n\tvar _time:Float;\n\tvar _startTime:Float;\n\tvar _prevTime:Float;\n\tvar _ticks:Int;\n\tvar _fpsMin:Float;\n\tvar _fpsMax:Float;\n\tvar _memCheck:Bool;\n\tvar _pos:String;\n\tvar _offset:Float;\n\tvar _measureCount:Int;\n\tvar _totalFps:Float;\n\n\tvar _perfObj:Performance;\n\tvar _memoryObj:Memory;\n\tvar _raf:Int;\n\n\tvar RAF:Dynamic;\n\tvar CAF:Dynamic;\n\n\tpublic function new(?pos = \"TR\", ?offset:Float = 0) {\n\t\t_perfObj = Browser.window.performance;\n\t\tif (Reflect.field(_perfObj, \"memory\") != null) _memoryObj = Reflect.field(_perfObj, \"memory\");\n\t\t_memCheck = (_perfObj != null && _memoryObj != null && _memoryObj.totalJSHeapSize > 0);\n\n\t\t_pos = pos;\n\t\t_offset = offset;\n\n\t\t_init();\n\t\t_createFpsDom();\n\t\t_createMsDom();\n\t\tif (_memCheck) _createMemoryDom();\n\n\t\tif (Browser.window.requestAnimationFrame != null) RAF = Browser.window.requestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozRequestAnimationFrame != null) RAF = untyped __js__(\"window\").mozRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitRequestAnimationFrame != null) RAF = untyped __js__(\"window\").webkitRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msRequestAnimationFrame != null) RAF = untyped __js__(\"window\").msRequestAnimationFrame;\n\n\t\tif (Browser.window.cancelAnimationFrame != null) CAF = Browser.window.cancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozCancelAnimationFrame != null) CAF = untyped __js__(\"window\").mozCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitCancelAnimationFrame != null) CAF = untyped __js__(\"window\").webkitCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msCancelAnimationFrame != null) CAF = untyped __js__(\"window\").msCancelAnimationFrame;\n\n\t\tif (RAF != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tinline function _init() {\n\t\tcurrentFps = 60;\n\t\tcurrentMs = 0;\n\t\tcurrentMem = \"0\";\n\n\t\tlowFps = 60;\n\t\tavgFps = 60;\n\n\t\t_measureCount = 0;\n\t\t_totalFps = 0;\n\t\t_time = 0;\n\t\t_ticks = 0;\n\t\t_fpsMin = 60;\n\t\t_fpsMax = 60;\n\t\t_startTime = _now();\n\t\t_prevTime = -MEASUREMENT_INTERVAL;\n\t}\n\n\tinline function _now():Float {\n\t\treturn (_perfObj != null && _perfObj.now != null) ? _perfObj.now() : Date.now().getTime();\n\t}\n\n\tfunction _tick(val:Float) {\n\t\tvar time = _now();\n\t\t_ticks++;\n\n\t\tif (_raf != null && time > _prevTime + MEASUREMENT_INTERVAL) {\n\t\t\tcurrentMs = Math.round(time - _startTime);\n\t\t\tms.innerHTML = \"MS: \" + currentMs;\n\n\t\t\tcurrentFps = Math.round((_ticks * 1000) / (time - _prevTime));\n\t\t\tif (currentFps > 0 && val > DELAY_TIME) {\n\t\t\t\t_measureCount++;\n\t\t\t\t_totalFps += currentFps;\n\t\t\t\tlowFps = _fpsMin = Math.min(_fpsMin, currentFps);\n\t\t\t\t_fpsMax = Math.max(_fpsMax, currentFps);\n\t\t\t\tavgFps = Math.round(_totalFps / _measureCount);\n\t\t\t}\n\n\t\t\tfps.innerHTML = \"FPS: \" + currentFps + \" (\" + _fpsMin + \"-\" + _fpsMax + \")\";\n\n\t\t\tif (currentFps >= 30) fps.style.backgroundColor = FPS_BG_CLR;\n\t\t\telse if (currentFps >= 15) fps.style.backgroundColor = FPS_WARN_BG_CLR;\n\t\t\telse fps.style.backgroundColor = FPS_PROB_BG_CLR;\n\n\t\t\t_prevTime = time;\n\t\t\t_ticks = 0;\n\n\t\t\tif (_memCheck) {\n\t\t\t\tcurrentMem = _getFormattedSize(_memoryObj.usedJSHeapSize, 2);\n\t\t\t\tmemory.innerHTML = \"MEM: \" + currentMem;\n\t\t\t}\n\t\t}\n\t\t_startTime = time;\n\n\t\tif (_raf != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tfunction _createDiv(id:String, ?top:Float = 0):DivElement {\n\t\tvar div:DivElement = Browser.document.createDivElement();\n\t\tdiv.id = id;\n\t\tdiv.className = id;\n\t\tdiv.style.position = \"absolute\";\n\n\t\tswitch (_pos) {\n\t\t\tcase \"TL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"TR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"BL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t\tcase \"BR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t}\n\n\t\tdiv.style.width = \"80px\";\n\t\tdiv.style.height = \"12px\";\n\t\tdiv.style.lineHeight = \"12px\";\n\t\tdiv.style.padding = \"2px\";\n\t\tdiv.style.fontFamily = FONT_FAMILY;\n\t\tdiv.style.fontSize = \"9px\";\n\t\tdiv.style.fontWeight = \"bold\";\n\t\tdiv.style.textAlign = \"center\";\n\t\tBrowser.document.body.appendChild(div);\n\t\treturn div;\n\t}\n\n\tfunction _createFpsDom() {\n\t\tfps = _createDiv(\"fps\");\n\t\tfps.style.backgroundColor = FPS_BG_CLR;\n\t\tfps.style.zIndex = \"995\";\n\t\tfps.style.color = FPS_TXT_CLR;\n\t\tfps.innerHTML = \"FPS: 0\";\n\t}\n\n\tfunction _createMsDom() {\n\t\tms = _createDiv(\"ms\", 16);\n\t\tms.style.backgroundColor = MS_BG_CLR;\n\t\tms.style.zIndex = \"996\";\n\t\tms.style.color = MS_TXT_CLR;\n\t\tms.innerHTML = \"MS: 0\";\n\t}\n\n\tfunction _createMemoryDom() {\n\t\tmemory = _createDiv(\"memory\", 32);\n\t\tmemory.style.backgroundColor = MEM_BG_CLR;\n\t\tmemory.style.color = MEM_TXT_CLR;\n\t\tmemory.style.zIndex = \"997\";\n\t\tmemory.innerHTML = \"MEM: 0\";\n\t}\n\n\tfunction _getFormattedSize(bytes:Float, ?frac:Int = 0):String {\n\t\tvar sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n\t\tif (bytes == 0) return \"0\";\n\t\tvar precision = Math.pow(10, frac);\n\t\tvar i = Math.floor(Math.log(bytes) / Math.log(1024));\n\t\treturn Math.round(bytes * precision / Math.pow(1024, i)) / precision + \" \" + sizes[i];\n\t}\n\n\tpublic function addInfo(val:String) {\n\t\tinfo = _createDiv(\"info\", (_memCheck) ? 48 : 32);\n\t\tinfo.style.backgroundColor = INFO_BG_CLR;\n\t\tinfo.style.color = INFO_TXT_CLR;\n\t\tinfo.style.zIndex = \"998\";\n\t\tinfo.innerHTML = val;\n\t}\n\n\tpublic function clearInfo() {\n\t\tif (info != null) {\n\t\t\tBrowser.document.body.removeChild(info);\n\t\t\tinfo = null;\n\t\t}\n\t}\n\n\tpublic function destroy() {\n\t\t_cancelRAF();\n\t\t_perfObj = null;\n\t\t_memoryObj = null;\n\t\tif (fps != null) {\n\t\t\tBrowser.document.body.removeChild(fps);\n\t\t\tfps = null;\n\t\t}\n\t\tif (ms != null) {\n\t\t\tBrowser.document.body.removeChild(ms);\n\t\t\tms = null;\n\t\t}\n\t\tif (memory != null) {\n\t\t\tBrowser.document.body.removeChild(memory);\n\t\t\tmemory = null;\n\t\t}\n\t\tclearInfo();\n\t\t_init();\n\t}\n\n\tinline function _cancelRAF() {\n\t\tReflect.callMethod(Browser.window, CAF, [_raf]);\n\t\t_raf = null;\n\t}\n}\n\ntypedef Memory = {\n\tvar usedJSHeapSize:Float;\n\tvar totalJSHeapSize:Float;\n\tvar jsHeapSizeLimit:Float;\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class Reflect {\n\n\tpublic inline static function hasField( o : Dynamic, field : String ) : Bool {\n\t\treturn untyped __js__('Object').prototype.hasOwnProperty.call(o, field);\n\t}\n\n\tpublic static function field( o : Dynamic, field : String ) : Dynamic {\n\t\ttry return untyped o[field] catch( e : Dynamic ) return null;\n\t}\n\n\tpublic inline static function setField( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\to[field] = value;\n\t}\n\n\tpublic static inline function getProperty( o : Dynamic, field : String ) : Dynamic untyped {\n\t\tvar tmp;\n\t\treturn if( o == null ) __define_feature__(\"Reflect.getProperty\",null) else if( o.__properties__ && (tmp=o.__properties__[\"get_\"+field]) ) o[tmp]() else o[field];\n\t}\n\n\tpublic static inline function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\tvar tmp;\n\t\tif( o.__properties__ && (tmp=o.__properties__[\"set_\"+field]) ) o[tmp](value) else o[field] = __define_feature__(\"Reflect.setProperty\",value);\n\t}\n\n\tpublic inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array ) : Dynamic untyped {\n\t\treturn func.apply(o,args);\n\t}\n\n\tpublic static function fields( o : Dynamic ) : Array {\n\t\tvar a = [];\n\t\tif (o != null) untyped {\n\t\t\tvar hasOwnProperty = __js__('Object').prototype.hasOwnProperty;\n\t\t\t__js__(\"for( var f in o ) {\");\n\t\t\tif( f != \"__id__\" && f != \"hx__closures__\" && hasOwnProperty.call(o, f) ) a.push(f);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static function isFunction( f : Dynamic ) : Bool untyped {\n\t\treturn __js__(\"typeof(f)\") == \"function\" && !(js.Boot.isClass(f) || js.Boot.isEnum(f));\n\t}\n\n\tpublic static function compare( a : T, b : T ) : Int {\n\t\treturn ( a == b ) ? 0 : (((cast a) > (cast b)) ? 1 : -1);\n\t}\n\n\tpublic static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool {\n\t\tif( f1 == f2 )\n\t\t\treturn true;\n\t\tif( !isFunction(f1) || !isFunction(f2) )\n\t\t\treturn false;\n\t\treturn f1.scope == f2.scope && f1.method == f2.method && f1.method != null;\n\t}\n\n\tpublic static function isObject( v : Dynamic ) : Bool untyped {\n\t\tif( v == null )\n\t\t\treturn false;\n\t\tvar t = __js__(\"typeof(v)\");\n\t\treturn (t == \"string\" || (t == \"object\" && v.__enum__ == null)) || (t == \"function\" && (js.Boot.isClass(v) || js.Boot.isEnum(v)) != null);\n\t}\n\n\tpublic static function isEnumValue( v : Dynamic ) : Bool {\n\t\treturn v != null && v.__enum__ != null;\n\t}\n\n\tpublic static function deleteField( o : Dynamic, field : String ) : Bool untyped {\n\t\tif( !hasField(o,field) ) return false;\n\t\t__js__(\"delete\")(o[field]);\n\t\treturn true;\n\t}\n\n\tpublic static function copy( o : T ) : T {\n\t\tvar o2 : Dynamic = {};\n\t\tfor( f in Reflect.fields(o) )\n\t\t\tReflect.setField(o2,f,Reflect.field(o,f));\n\t\treturn o2;\n\t}\n\n\t@:overload(function( f : Array -> Void ) : Dynamic {})\n\tpublic static function makeVarArgs( f : Array -> Dynamic ) : Dynamic {\n\t\treturn function() {\n\t\t\tvar a = untyped Array.prototype.slice.call(__js__(\"arguments\"));\n\t\t\treturn f(a);\n\t\t};\n\t}\n\n}\n","package pixi.plugins.app;\n\nimport pixi.core.renderers.webgl.WebGLRenderer;\nimport pixi.core.renderers.canvas.CanvasRenderer;\nimport pixi.core.renderers.Detector;\nimport pixi.core.display.Container;\nimport js.html.Event;\nimport js.html.Element;\nimport js.html.CanvasElement;\nimport js.Browser;\n\n/**\n * Pixi Boilerplate Helper class that can be used by any application\n * @author Adi Reddy Mora\n * http://adireddy.github.io\n * @license MIT\n * @copyright 2015\n */\nclass Application {\n\n\t/**\n * Sets the pixel ratio of the application.\n * default - 1\n */\n\tpublic var pixelRatio:Float;\n\n\t/**\n\t * Default frame rate is 60 FPS and this can be set to true to get 30 FPS.\n\t * default - false\n\t */\n\tpublic var skipFrame(default, set):Bool;\n\n\t/**\n\t * Default frame rate is 60 FPS and this can be set to anything between 1 - 60.\n\t * default - 60\n\t */\n\tpublic var fps(default, set):Int;\n\n\t/**\n\t * Width of the application.\n\t * default - Browser.window.innerWidth\n\t */\n\tpublic var width:Float;\n\n\t/**\n\t * Height of the application.\n\t * default - Browser.window.innerHeight\n\t */\n\tpublic var height:Float;\n\n\t/**\n\t * Position of canvas element\n\t * default - static\n\t */\n\tpublic var position:String;\n\n\t/**\n\t * Renderer transparency property.\n\t * default - false\n\t */\n\tpublic var transparent:Bool;\n\n\t/**\n\t * Graphics antialias property.\n\t * default - false\n\t */\n\tpublic var antialias:Bool;\n\n\t/**\n\t * Force FXAA shader antialias instead of native (faster).\n\t * default - false\n\t */\n\tpublic var forceFXAA:Bool;\n\n\t/**\n\t * Force round pixels.\n\t * default - false\n\t */\n\tpublic var roundPixels:Bool;\n\n\t/**\n\t * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.\n * If the scene is transparent Pixi will use clearRect to clear the canvas every frame.\n * Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.\n\t * default - true\n\t */\n\tpublic var clearBeforeRender:Bool;\n\n\t/**\n\t * enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context\n\t * default - false\n\t */\n\tpublic var preserveDrawingBuffer:Bool;\n\n\t/**\n\t * Whether you want to resize the canvas and renderer on browser resize.\n\t * Should be set to false when custom width and height are used for the application.\n\t * default - true\n\t */\n\tpublic var autoResize:Bool;\n\n\t/**\n\t * Sets the background color of the stage.\n\t * default - 0xFFFFFF\n\t */\n\tpublic var backgroundColor:Int;\n\n\t/**\n\t * Update listener \tfunction\n\t */\n\tpublic var onUpdate:Float -> Void;\n\n\t/**\n\t * Window resize listener \tfunction\n\t */\n\tpublic var onResize:Void -> Void;\n\n\t/**\n\t * Canvas Element\n\t * Read-only\n\t */\n\tpublic var canvas(default, null):CanvasElement;\n\n\t/**\n\t * Renderer\n\t * Read-only\n\t */\n\tpublic var renderer(default, null):Dynamic;\n\n\t/**\n\t * Global Container.\n\t * Read-only\n\t */\n\tpublic var stage(default, null):Container;\n\n\tpublic static inline var AUTO:String = \"auto\";\n\tpublic static inline var RECOMMENDED:String = \"recommended\";\n\tpublic static inline var CANVAS:String = \"canvas\";\n\tpublic static inline var WEBGL:String = \"webgl\";\n\n\tvar _frameCount:Int;\n\tvar _animationFrameId:Null;\n\n\tpublic function new() {\n\t\t_setDefaultValues();\n\t}\n\n\tfunction set_fps(val:Int):Int {\n\t\t_frameCount = 0;\n\t\treturn fps = (val >= 1 && val < 60) ? Std.int(val) : 60;\n\t}\n\n\tfunction set_skipFrame(val:Bool):Bool {\n\t\tif (val) {\n\t\t\ttrace(\"pixi.plugins.app.Application > Deprecated: skipFrame - use fps property and set it to 30 instead\");\n\t\t\tfps = 30;\n\t\t}\n\t\treturn skipFrame = val;\n\t}\n\n\tinline function _setDefaultValues() {\n\t\t_animationFrameId = null;\n\t\tpixelRatio = 1;\n\t\tskipFrame = false;\n\t\tautoResize = true;\n\t\ttransparent = false;\n\t\tantialias = false;\n\t\tforceFXAA = false;\n\t\troundPixels = false;\n\t\tclearBeforeRender = true;\n\t\tpreserveDrawingBuffer = false;\n\t\tbackgroundColor = 0xFFFFFF;\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tposition = \"static\";\n\t\tfps = 60;\n\t}\n\n\t/**\n\t * Starts pixi application setup using the properties set or default values\n\t * @param [rendererType] - Renderer type to use AUTO (default) | CANVAS | WEBGL\n\t * @param [stats] - Enable/disable stats for the application.\n\t * Note that stats.js is not part of pixi so don't forget to include it you html page\n\t * Can be found in libs folder. \"libs/stats.min.js\" \n\t * @param [parentDom] - By default canvas will be appended to body or it can be appended to custom element if passed\n\t */\n\n\tpublic function start(?rendererType:String = \"auto\", ?parentDom:Element, ?canvasElement:CanvasElement) {\n\t\tif (canvasElement == null) {\n\t\t\tcanvas = Browser.document.createCanvasElement();\n\t\t\tcanvas.style.width = width + \"px\";\n\t\t\tcanvas.style.height = height + \"px\";\n\t\t\tcanvas.style.position = position;\n\t\t}\n\t\telse canvas = canvasElement;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(canvas);\n\t\telse parentDom.appendChild(canvas);\n\n\t\tstage = new Container();\n\n\t\tvar renderingOptions:RenderingOptions = {};\n\t\trenderingOptions.view = canvas;\n\t\trenderingOptions.backgroundColor = backgroundColor;\n\t\trenderingOptions.resolution = pixelRatio;\n\t\trenderingOptions.antialias = antialias;\n\t\trenderingOptions.forceFXAA = forceFXAA;\n\t\trenderingOptions.autoResize = autoResize;\n\t\trenderingOptions.transparent = transparent;\n\t\trenderingOptions.clearBeforeRender = clearBeforeRender;\n\t\trenderingOptions.preserveDrawingBuffer = preserveDrawingBuffer;\n\n\t\tif (rendererType == AUTO) renderer = Detector.autoDetectRenderer(width, height, renderingOptions);\n\t\telse if (rendererType == CANVAS) renderer = new CanvasRenderer(width, height, renderingOptions);\n\t\telse renderer = new WebGLRenderer(width, height, renderingOptions);\n\n\t\tif (roundPixels) renderer.roundPixels = true;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(renderer.view);\n\t\telse parentDom.appendChild(renderer.view);\n\t\tresumeRendering();\n\t\t#if stats addStats(); #end\n\t}\n\n\tpublic function pauseRendering() {\n\t\tBrowser.window.onresize = null;\n\t\tif (_animationFrameId != null) {\n\t\t\tBrowser.window.cancelAnimationFrame(_animationFrameId);\n\t\t\t_animationFrameId = null;\n\t\t}\n\t}\n\n\tpublic function resumeRendering() {\n\t\tif (autoResize) Browser.window.onresize = _onWindowResize;\n\t\tif (_animationFrameId == null) _animationFrameId = Browser.window.requestAnimationFrame(_onRequestAnimationFrame);\n\t}\n\n\t@:noCompletion function _onWindowResize(event:Event) {\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\trenderer.resize(width, height);\n\t\tcanvas.style.width = width + \"px\";\n\t\tcanvas.style.height = height + \"px\";\n\n\t\tif (onResize != null) onResize();\n\t}\n\n\t@:noCompletion function _onRequestAnimationFrame(elapsedTime:Float) {\n\t\t_frameCount++;\n\t\tif (_frameCount == Std.int(60 / fps)) {\n\t\t\t_frameCount = 0;\n\t\t\tif (onUpdate != null) onUpdate(elapsedTime);\n\t\t\trenderer.render(stage);\n\t\t}\n\t\t_animationFrameId = Browser.window.requestAnimationFrame(_onRequestAnimationFrame);\n\t}\n\n\tpublic function addStats() {\n\t\tif (untyped __js__(\"window\").Perf != null) {\n\t\t\tnew Perf().addInfo([\"UNKNOWN\", \"WEBGL\", \"CANVAS\"][renderer.type] + \" - \" + pixelRatio);\n\t\t}\n\t}\n}","package filters.colormatrix;\n\nimport pixi.core.text.DefaultStyle;\nimport pixi.interaction.EventTarget;\nimport pixi.core.display.Container;\nimport pixi.filters.colormatrix.ColorMatrixFilter;\nimport pixi.core.text.Text;\nimport pixi.core.sprites.Sprite;\nimport pixi.plugins.app.Application;\nimport js.Browser;\n\nclass Main extends Application {\n\n\tvar _bg:Sprite;\n\tvar _container:Container;\n\tvar _colorMatrix:Array;\n\tvar _filter:ColorMatrixFilter;\n\n\tvar _bgFront:Sprite;\n\tvar _light1:Sprite;\n\tvar _light2:Sprite;\n\tvar _panda:Sprite;\n\n\tvar _count:Float;\n\tvar _switchy:Bool;\n\n\tpublic function new() {\n\t\tsuper();\n\t\t_init();\n\n\t\tstage.interactive = true;\n\t\t_container = new Container();\n\t\t_container.position.set(Browser.window.innerWidth / 2, Browser.window.innerHeight / 2);\n\t\tstage.addChild(_container);\n\n\t\t_bg = Sprite.fromImage(\"assets/filters/BGrotate.jpg\");\n\t\t_bg.anchor.set(0.5);\n\n\t\t_colorMatrix = [1, 0, 0, 0,\n\t\t\t\t\t\t0, 1, 0, 0,\n\t\t\t\t\t\t0, 0, 1, 0,\n\t\t\t\t\t\t0, 0, 0, 1];\n\n\t\t_filter = new ColorMatrixFilter();\n\n\t\t_bgFront = Sprite.fromImage(\"assets/filters/SceneRotate.jpg\");\n\t\t_bgFront.anchor.set(0.5);\n\t\t_container.addChild(_bgFront);\n\n\t\t_light2 = Sprite.fromImage(\"assets/filters/LightRotate2.png\");\n\t\t_light2.anchor.set(0.5);\n\t\t_container.addChild(_light2);\n\n\t\t_light1 = Sprite.fromImage(\"assets/filters/LightRotate1.png\");\n\t\t_light1.anchor.set(0.5);\n\t\t_container.addChild(_light1);\n\n\t\t_panda = Sprite.fromImage(\"assets/filters/panda.png\");\n\t\t_panda.anchor.set(0.5);\n\t\t_container.addChild(_panda);\n\n\t\t_count = 0;\n\t\t_switchy = false;\n\t\t_container.filters = [_filter];\n\n\t\tstage.on(\"click\", _onClick);\n\t\tstage.on(\"tap\", _onClick);\n\n\t\tvar style:DefaultStyle = {fontSize: \"12\", fontFamily:\"Arial\", fontWeight: \"bold\", fill: 0xFFFFFF};\n\t\tvar help = new Text(\"Click to turn filters on / off.\", style);\n\t\tstage.addChild(help);\n\t}\n\n\tfunction _init() {\n\t\tposition = \"fixed\";\n\t\tbackgroundColor = 0x00FF66;\n\t\tonUpdate = _onUpdate;\n\t\tsuper.start();\n\t}\n\n\tfunction _onUpdate(elapsedTime:Float) {\n\t\t_count += 0.01;\n\n\t\t_bg.rotation += 0.01;\n\t\t_bgFront.rotation -= 0.01;\n\n\t\t_light1.rotation += 0.02;\n\t\t_light2.rotation += 0.01;\n\n\t\t_panda.scale.x = 1 + Math.sin(_count) * 0.04;\n\t\t_panda.scale.y = 1 + Math.cos(_count) * 0.04;\n\n\t\t_count += 0.1;\n\n\t\t_colorMatrix[1] = Math.sin(_count) * 3;\n\t\t_colorMatrix[2] = Math.cos(_count);\n\t\t_colorMatrix[3] = Math.cos(_count) * 1.5;\n\t\t_colorMatrix[4] = Math.sin(_count / 3) * 2;\n\t\t_colorMatrix[5] = Math.sin(_count / 2);\n\t\t_colorMatrix[6] = Math.sin(_count / 4);\n\t\t_filter.matrix = _colorMatrix;\n\t}\n\n\tfunction _onClick(data:EventTarget) {\n\t\t_switchy = !_switchy;\n\t\tif (!_switchy) _container.filters = [_filter];\n\t\telse _container.filters = null;\n\t}\n\n\tstatic function main() {\n\t\tnew Main();\n\t}\n}"],
+"sourcesContent":["import js.html.Performance;\nimport js.html.DivElement;\nimport js.Browser;\n\n@:expose class Perf {\n\n\tpublic static var MEASUREMENT_INTERVAL:Int = 1000;\n\n\tpublic static var FONT_FAMILY:String = \"Helvetica,Arial\";\n\n\tpublic static var FPS_BG_CLR:String = \"#00FF00\";\n\tpublic static var FPS_WARN_BG_CLR:String = \"#FF8000\";\n\tpublic static var FPS_PROB_BG_CLR:String = \"#FF0000\";\n\n\tpublic static var MS_BG_CLR:String = \"#FFFF00\";\n\tpublic static var MEM_BG_CLR:String = \"#086A87\";\n\tpublic static var INFO_BG_CLR:String = \"#00FFFF\";\n\tpublic static var FPS_TXT_CLR:String = \"#000000\";\n\tpublic static var MS_TXT_CLR:String = \"#000000\";\n\tpublic static var MEM_TXT_CLR:String = \"#FFFFFF\";\n\tpublic static var INFO_TXT_CLR:String = \"#000000\";\n\n\tpublic static var TOP_LEFT:String = \"TL\";\n\tpublic static var TOP_RIGHT:String = \"TR\";\n\tpublic static var BOTTOM_LEFT:String = \"BL\";\n\tpublic static var BOTTOM_RIGHT:String = \"BR\";\n\n\tstatic var DELAY_TIME:Int = 4000;\n\n\tpublic var fps:DivElement;\n\tpublic var ms:DivElement;\n\tpublic var memory:DivElement;\n\tpublic var info:DivElement;\n\n\tpublic var lowFps:Float;\n\tpublic var avgFps:Float;\n\tpublic var currentFps:Float;\n\tpublic var currentMs:Float;\n\tpublic var currentMem:String;\n\n\tvar _time:Float;\n\tvar _startTime:Float;\n\tvar _prevTime:Float;\n\tvar _ticks:Int;\n\tvar _fpsMin:Float;\n\tvar _fpsMax:Float;\n\tvar _memCheck:Bool;\n\tvar _pos:String;\n\tvar _offset:Float;\n\tvar _measureCount:Int;\n\tvar _totalFps:Float;\n\n\tvar _perfObj:Performance;\n\tvar _memoryObj:Memory;\n\tvar _raf:Int;\n\n\tvar RAF:Dynamic;\n\tvar CAF:Dynamic;\n\n\tpublic function new(?pos = \"TR\", ?offset:Float = 0) {\n\t\t_perfObj = Browser.window.performance;\n\t\tif (Reflect.field(_perfObj, \"memory\") != null) _memoryObj = Reflect.field(_perfObj, \"memory\");\n\t\t_memCheck = (_perfObj != null && _memoryObj != null && _memoryObj.totalJSHeapSize > 0);\n\n\t\t_pos = pos;\n\t\t_offset = offset;\n\n\t\t_init();\n\t\t_createFpsDom();\n\t\t_createMsDom();\n\t\tif (_memCheck) _createMemoryDom();\n\n\t\tif (Browser.window.requestAnimationFrame != null) RAF = Browser.window.requestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozRequestAnimationFrame != null) RAF = untyped __js__(\"window\").mozRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitRequestAnimationFrame != null) RAF = untyped __js__(\"window\").webkitRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msRequestAnimationFrame != null) RAF = untyped __js__(\"window\").msRequestAnimationFrame;\n\n\t\tif (Browser.window.cancelAnimationFrame != null) CAF = Browser.window.cancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozCancelAnimationFrame != null) CAF = untyped __js__(\"window\").mozCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitCancelAnimationFrame != null) CAF = untyped __js__(\"window\").webkitCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msCancelAnimationFrame != null) CAF = untyped __js__(\"window\").msCancelAnimationFrame;\n\n\t\tif (RAF != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tinline function _init() {\n\t\tcurrentFps = 60;\n\t\tcurrentMs = 0;\n\t\tcurrentMem = \"0\";\n\n\t\tlowFps = 60;\n\t\tavgFps = 60;\n\n\t\t_measureCount = 0;\n\t\t_totalFps = 0;\n\t\t_time = 0;\n\t\t_ticks = 0;\n\t\t_fpsMin = 60;\n\t\t_fpsMax = 60;\n\t\t_startTime = _now();\n\t\t_prevTime = -MEASUREMENT_INTERVAL;\n\t}\n\n\tinline function _now():Float {\n\t\treturn (_perfObj != null && _perfObj.now != null) ? _perfObj.now() : Date.now().getTime();\n\t}\n\n\tfunction _tick(val:Float) {\n\t\tvar time = _now();\n\t\t_ticks++;\n\n\t\tif (_raf != null && time > _prevTime + MEASUREMENT_INTERVAL) {\n\t\t\tcurrentMs = Math.round(time - _startTime);\n\t\t\tms.innerHTML = \"MS: \" + currentMs;\n\n\t\t\tcurrentFps = Math.round((_ticks * 1000) / (time - _prevTime));\n\t\t\tif (currentFps > 0 && val > DELAY_TIME) {\n\t\t\t\t_measureCount++;\n\t\t\t\t_totalFps += currentFps;\n\t\t\t\tlowFps = _fpsMin = Math.min(_fpsMin, currentFps);\n\t\t\t\t_fpsMax = Math.max(_fpsMax, currentFps);\n\t\t\t\tavgFps = Math.round(_totalFps / _measureCount);\n\t\t\t}\n\n\t\t\tfps.innerHTML = \"FPS: \" + currentFps + \" (\" + _fpsMin + \"-\" + _fpsMax + \")\";\n\n\t\t\tif (currentFps >= 30) fps.style.backgroundColor = FPS_BG_CLR;\n\t\t\telse if (currentFps >= 15) fps.style.backgroundColor = FPS_WARN_BG_CLR;\n\t\t\telse fps.style.backgroundColor = FPS_PROB_BG_CLR;\n\n\t\t\t_prevTime = time;\n\t\t\t_ticks = 0;\n\n\t\t\tif (_memCheck) {\n\t\t\t\tcurrentMem = _getFormattedSize(_memoryObj.usedJSHeapSize, 2);\n\t\t\t\tmemory.innerHTML = \"MEM: \" + currentMem;\n\t\t\t}\n\t\t}\n\t\t_startTime = time;\n\n\t\tif (_raf != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tfunction _createDiv(id:String, ?top:Float = 0):DivElement {\n\t\tvar div:DivElement = Browser.document.createDivElement();\n\t\tdiv.id = id;\n\t\tdiv.className = id;\n\t\tdiv.style.position = \"absolute\";\n\n\t\tswitch (_pos) {\n\t\t\tcase \"TL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"TR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"BL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t\tcase \"BR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t}\n\n\t\tdiv.style.width = \"80px\";\n\t\tdiv.style.height = \"12px\";\n\t\tdiv.style.lineHeight = \"12px\";\n\t\tdiv.style.padding = \"2px\";\n\t\tdiv.style.fontFamily = FONT_FAMILY;\n\t\tdiv.style.fontSize = \"9px\";\n\t\tdiv.style.fontWeight = \"bold\";\n\t\tdiv.style.textAlign = \"center\";\n\t\tBrowser.document.body.appendChild(div);\n\t\treturn div;\n\t}\n\n\tfunction _createFpsDom() {\n\t\tfps = _createDiv(\"fps\");\n\t\tfps.style.backgroundColor = FPS_BG_CLR;\n\t\tfps.style.zIndex = \"995\";\n\t\tfps.style.color = FPS_TXT_CLR;\n\t\tfps.innerHTML = \"FPS: 0\";\n\t}\n\n\tfunction _createMsDom() {\n\t\tms = _createDiv(\"ms\", 16);\n\t\tms.style.backgroundColor = MS_BG_CLR;\n\t\tms.style.zIndex = \"996\";\n\t\tms.style.color = MS_TXT_CLR;\n\t\tms.innerHTML = \"MS: 0\";\n\t}\n\n\tfunction _createMemoryDom() {\n\t\tmemory = _createDiv(\"memory\", 32);\n\t\tmemory.style.backgroundColor = MEM_BG_CLR;\n\t\tmemory.style.color = MEM_TXT_CLR;\n\t\tmemory.style.zIndex = \"997\";\n\t\tmemory.innerHTML = \"MEM: 0\";\n\t}\n\n\tfunction _getFormattedSize(bytes:Float, ?frac:Int = 0):String {\n\t\tvar sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n\t\tif (bytes == 0) return \"0\";\n\t\tvar precision = Math.pow(10, frac);\n\t\tvar i = Math.floor(Math.log(bytes) / Math.log(1024));\n\t\treturn Math.round(bytes * precision / Math.pow(1024, i)) / precision + \" \" + sizes[i];\n\t}\n\n\tpublic function addInfo(val:String) {\n\t\tinfo = _createDiv(\"info\", (_memCheck) ? 48 : 32);\n\t\tinfo.style.backgroundColor = INFO_BG_CLR;\n\t\tinfo.style.color = INFO_TXT_CLR;\n\t\tinfo.style.zIndex = \"998\";\n\t\tinfo.innerHTML = val;\n\t}\n\n\tpublic function clearInfo() {\n\t\tif (info != null) {\n\t\t\tBrowser.document.body.removeChild(info);\n\t\t\tinfo = null;\n\t\t}\n\t}\n\n\tpublic function destroy() {\n\t\t_cancelRAF();\n\t\t_perfObj = null;\n\t\t_memoryObj = null;\n\t\tif (fps != null) {\n\t\t\tBrowser.document.body.removeChild(fps);\n\t\t\tfps = null;\n\t\t}\n\t\tif (ms != null) {\n\t\t\tBrowser.document.body.removeChild(ms);\n\t\t\tms = null;\n\t\t}\n\t\tif (memory != null) {\n\t\t\tBrowser.document.body.removeChild(memory);\n\t\t\tmemory = null;\n\t\t}\n\t\tclearInfo();\n\t\t_init();\n\t}\n\n\tinline function _cancelRAF() {\n\t\tReflect.callMethod(Browser.window, CAF, [_raf]);\n\t\t_raf = null;\n\t}\n}\n\ntypedef Memory = {\n\tvar usedJSHeapSize:Float;\n\tvar totalJSHeapSize:Float;\n\tvar jsHeapSizeLimit:Float;\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class Reflect {\n\n\tpublic inline static function hasField( o : Dynamic, field : String ) : Bool {\n\t\treturn untyped __js__('Object').prototype.hasOwnProperty.call(o, field);\n\t}\n\n\tpublic static function field( o : Dynamic, field : String ) : Dynamic {\n\t\ttry return untyped o[field] catch( e : Dynamic ) return null;\n\t}\n\n\tpublic inline static function setField( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\to[field] = value;\n\t}\n\n\tpublic static inline function getProperty( o : Dynamic, field : String ) : Dynamic untyped {\n\t\tvar tmp;\n\t\treturn if( o == null ) __define_feature__(\"Reflect.getProperty\",null) else if( o.__properties__ && (tmp=o.__properties__[\"get_\"+field]) ) o[tmp]() else o[field];\n\t}\n\n\tpublic static inline function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\tvar tmp;\n\t\tif( o.__properties__ && (tmp=o.__properties__[\"set_\"+field]) ) o[tmp](value) else o[field] = __define_feature__(\"Reflect.setProperty\",value);\n\t}\n\n\tpublic inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array ) : Dynamic untyped {\n\t\treturn func.apply(o,args);\n\t}\n\n\tpublic static function fields( o : Dynamic ) : Array {\n\t\tvar a = [];\n\t\tif (o != null) untyped {\n\t\t\tvar hasOwnProperty = __js__('Object').prototype.hasOwnProperty;\n\t\t\t__js__(\"for( var f in o ) {\");\n\t\t\tif( f != \"__id__\" && f != \"hx__closures__\" && hasOwnProperty.call(o, f) ) a.push(f);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static function isFunction( f : Dynamic ) : Bool untyped {\n\t\treturn __js__(\"typeof(f)\") == \"function\" && !(js.Boot.isClass(f) || js.Boot.isEnum(f));\n\t}\n\n\tpublic static function compare( a : T, b : T ) : Int {\n\t\treturn ( a == b ) ? 0 : (((cast a) > (cast b)) ? 1 : -1);\n\t}\n\n\tpublic static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool {\n\t\tif( f1 == f2 )\n\t\t\treturn true;\n\t\tif( !isFunction(f1) || !isFunction(f2) )\n\t\t\treturn false;\n\t\treturn f1.scope == f2.scope && f1.method == f2.method && f1.method != null;\n\t}\n\n\tpublic static function isObject( v : Dynamic ) : Bool untyped {\n\t\tif( v == null )\n\t\t\treturn false;\n\t\tvar t = __js__(\"typeof(v)\");\n\t\treturn (t == \"string\" || (t == \"object\" && v.__enum__ == null)) || (t == \"function\" && (js.Boot.isClass(v) || js.Boot.isEnum(v)) != null);\n\t}\n\n\tpublic static function isEnumValue( v : Dynamic ) : Bool {\n\t\treturn v != null && v.__enum__ != null;\n\t}\n\n\tpublic static function deleteField( o : Dynamic, field : String ) : Bool untyped {\n\t\tif( !hasField(o,field) ) return false;\n\t\t__js__(\"delete\")(o[field]);\n\t\treturn true;\n\t}\n\n\tpublic static function copy( o : T ) : T {\n\t\tvar o2 : Dynamic = {};\n\t\tfor( f in Reflect.fields(o) )\n\t\t\tReflect.setField(o2,f,Reflect.field(o,f));\n\t\treturn o2;\n\t}\n\n\t@:overload(function( f : Array -> Void ) : Dynamic {})\n\tpublic static function makeVarArgs( f : Array -> Dynamic ) : Dynamic {\n\t\treturn function() {\n\t\t\tvar a = untyped Array.prototype.slice.call(__js__(\"arguments\"));\n\t\t\treturn f(a);\n\t\t};\n\t}\n\n}\n","package pixi.plugins.app;\n\nimport pixi.core.renderers.SystemRenderer;\nimport js.html.Event;\nimport pixi.core.RenderOptions;\nimport pixi.core.display.Container;\nimport js.html.Element;\nimport js.html.CanvasElement;\nimport js.Browser;\n\n/**\n * Pixi Boilerplate Helper class that can be used by any application\n * @author Adi Reddy Mora\n * http://adireddy.github.io\n * @license MIT\n * @copyright 2015\n */\nclass Application {\n\n\t/**\n * Sets the pixel ratio of the application.\n * default - 1\n */\n\tpublic var pixelRatio:Float;\n\n\t/**\n\t * Width of the application.\n\t * default - Browser.window.innerWidth\n\t */\n\tpublic var width:Float;\n\n\t/**\n\t * Height of the application.\n\t * default - Browser.window.innerHeight\n\t */\n\tpublic var height:Float;\n\n\t/**\n\t * Position of canvas element\n\t * default - static\n\t */\n\tpublic var position:String;\n\n\t/**\n\t * Renderer transparency property.\n\t * default - false\n\t */\n\tpublic var transparent:Bool;\n\n\t/**\n\t * Graphics antialias property.\n\t * default - false\n\t */\n\tpublic var antialias:Bool;\n\n\t/**\n\t * Force FXAA shader antialias instead of native (faster).\n\t * default - false\n\t */\n\tpublic var forceFXAA:Bool;\n\n\t/**\n\t * Force round pixels.\n\t * default - false\n\t */\n\tpublic var roundPixels:Bool;\n\n\t/**\n\t * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.\n * If the scene is transparent Pixi will use clearRect to clear the canvas every frame.\n * Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.\n\t * default - true\n\t */\n\tpublic var clearBeforeRender:Bool;\n\n\t/**\n\t * enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context\n\t * default - false\n\t */\n\tpublic var preserveDrawingBuffer:Bool;\n\n\t/**\n\t * Whether you want to resize the canvas and renderer on browser resize.\n\t * Should be set to false when custom width and height are used for the application.\n\t * default - true\n\t */\n\tpublic var autoResize:Bool;\n\n\t/**\n\t * Sets the background color of the stage.\n\t * default - 0xFFFFFF\n\t */\n\tpublic var backgroundColor:Int;\n\n\t/**\n\t * Update listener \tfunction\n\t */\n\tpublic var onUpdate:Float -> Void;\n\n\t/**\n\t * Window resize listener \tfunction\n\t */\n\tpublic var onResize:Void -> Void;\n\n\t/**\n\t * Canvas Element\n\t * Read-only\n\t */\n\tpublic var canvas(default, null):CanvasElement;\n\n\t/**\n\t * Renderer\n\t * Read-only\n\t */\n\tpublic var renderer(default, null):SystemRenderer;\n\n\t/**\n\t * Global Container.\n\t * Read-only\n\t */\n\tpublic var stage(default, null):Container;\n\n\t/**\n\t * Pixi Application\n\t * Read-only\n\t */\n\tpublic var app(default, null):pixi.core.Application;\n\n\tpublic static inline var AUTO:String = \"auto\";\n\tpublic static inline var RECOMMENDED:String = \"recommended\";\n\tpublic static inline var CANVAS:String = \"canvas\";\n\tpublic static inline var WEBGL:String = \"webgl\";\n\n\tpublic static inline var POSITION_STATIC:String = \"static\";\n\tpublic static inline var POSITION_ABSOLUTE:String = \"absolute\";\n\tpublic static inline var POSITION_FIXED:String = \"fixed\";\n\tpublic static inline var POSITION_RELATIVE:String = \"relative\";\n\tpublic static inline var POSITION_INITIAL:String = \"initial\";\n\tpublic static inline var POSITION_INHERIT:String = \"inherit\";\n\n\tvar _frameCount:Int;\n\tvar _animationFrameId:Null;\n\n\tpublic function new() {\n\t\t_setDefaultValues();\n\t}\n\n\tinline function _setDefaultValues() {\n\t\t_animationFrameId = null;\n\t\tpixelRatio = 1;\n\t\tautoResize = true;\n\t\ttransparent = false;\n\t\tantialias = false;\n\t\tforceFXAA = false;\n\t\troundPixels = false;\n\t\tclearBeforeRender = true;\n\t\tpreserveDrawingBuffer = false;\n\t\tbackgroundColor = 0xFFFFFF;\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tposition = \"static\";\n\t}\n\n\t/**\n\t * Starts pixi application setup using the properties set or default values\n\t * @param [rendererType] - Renderer type to use AUTO (default) | CANVAS | WEBGL\n\t * @param [stats] - Enable/disable stats for the application.\n\t * Note that stats.js is not part of pixi so don't forget to include it you html page\n\t * Can be found in libs folder. \"libs/stats.min.js\" \n\t * @param [parentDom] - By default canvas will be appended to body or it can be appended to custom element if passed\n\t */\n\n\tpublic function start(?rendererType:String = \"auto\", ?parentDom:Element, ?canvasElement:CanvasElement) {\n\t\tif (canvasElement == null) {\n\t\t\tcanvas = Browser.document.createCanvasElement();\n\t\t\tcanvas.style.width = width + \"px\";\n\t\t\tcanvas.style.height = height + \"px\";\n\t\t\tcanvas.style.position = position;\n\t\t}\n\t\telse canvas = canvasElement;\n\n\t\tif (autoResize) Browser.window.onresize = _onWindowResize;\n\n\t\tvar renderingOptions:RenderOptions = {};\n\t\trenderingOptions.view = canvas;\n\t\trenderingOptions.backgroundColor = backgroundColor;\n\t\trenderingOptions.resolution = pixelRatio;\n\t\trenderingOptions.antialias = antialias;\n\t\trenderingOptions.forceFXAA = forceFXAA;\n\t\trenderingOptions.autoResize = autoResize;\n\t\trenderingOptions.transparent = transparent;\n\t\trenderingOptions.clearBeforeRender = clearBeforeRender;\n\t\trenderingOptions.preserveDrawingBuffer = preserveDrawingBuffer;\n\t\trenderingOptions.roundPixels = roundPixels;\n\n\t\tswitch (rendererType) {\n\t\t\tcase CANVAS: app = new pixi.core.Application(width, height, renderingOptions, true);\n\t\t\tdefault: app = new pixi.core.Application(width, height, renderingOptions);\n\t\t}\n\n\t\tstage = app.stage;\n\t\trenderer = app.renderer;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(app.view);\n\t\telse parentDom.appendChild(app.view);\n\n\t\tapp.ticker.add(_onRequestAnimationFrame);\n\n\t\t#if stats addStats(); #end\n\t}\n\n\tpublic function pauseRendering() {\n\t\tapp.stop();\n\t}\n\n\tpublic function resumeRendering() {\n\t\tapp.start();\n\t}\n\n\t@:noCompletion function _onWindowResize(event:Event) {\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tapp.renderer.resize(width, height);\n\t\tcanvas.style.width = width + \"px\";\n\t\tcanvas.style.height = height + \"px\";\n\n\t\tif (onResize != null) onResize();\n\t}\n\n\t@:noCompletion function _onRequestAnimationFrame() {\n\t\tif (onUpdate != null) onUpdate(app.ticker.deltaTime);\n\t}\n\n\tpublic function addStats() {\n\t\tif (untyped __js__(\"window\").Perf != null) {\n\t\t\tnew Perf().addInfo([\"UNKNOWN\", \"WEBGL\", \"CANVAS\"][app.renderer.type] + \" - \" + pixelRatio);\n\t\t}\n\t}\n}","package filters.colormatrix;\n\nimport pixi.core.text.DefaultStyle;\nimport pixi.interaction.EventTarget;\nimport pixi.core.display.Container;\nimport pixi.filters.colormatrix.ColorMatrixFilter;\nimport pixi.core.text.Text;\nimport pixi.core.sprites.Sprite;\nimport pixi.plugins.app.Application;\nimport js.Browser;\n\nclass Main extends Application {\n\n\tvar _bg:Sprite;\n\tvar _container:Container;\n\tvar _colorMatrix:Array;\n\tvar _filter:ColorMatrixFilter;\n\n\tvar _bgFront:Sprite;\n\tvar _light1:Sprite;\n\tvar _light2:Sprite;\n\tvar _panda:Sprite;\n\n\tvar _count:Float;\n\tvar _switchy:Bool;\n\n\tpublic function new() {\n\t\tsuper();\n\t\t_init();\n\n\t\tstage.interactive = true;\n\t\t_container = new Container();\n\t\t_container.position.set(Browser.window.innerWidth / 2, Browser.window.innerHeight / 2);\n\t\tstage.addChild(_container);\n\n\t\t_bg = Sprite.fromImage(\"assets/filters/BGrotate.jpg\");\n\t\t_bg.anchor.set(0.5);\n\n\t\t_colorMatrix = [1, 0, 0, 0,\n\t\t\t\t\t\t0, 1, 0, 0,\n\t\t\t\t\t\t0, 0, 1, 0,\n\t\t\t\t\t\t0, 0, 0, 1];\n\n\t\t_filter = new ColorMatrixFilter();\n\n\t\t_bgFront = Sprite.fromImage(\"assets/filters/SceneRotate.jpg\");\n\t\t_bgFront.anchor.set(0.5);\n\t\t_container.addChild(_bgFront);\n\n\t\t_light2 = Sprite.fromImage(\"assets/filters/LightRotate2.png\");\n\t\t_light2.anchor.set(0.5);\n\t\t_container.addChild(_light2);\n\n\t\t_light1 = Sprite.fromImage(\"assets/filters/LightRotate1.png\");\n\t\t_light1.anchor.set(0.5);\n\t\t_container.addChild(_light1);\n\n\t\t_panda = Sprite.fromImage(\"assets/filters/panda.png\");\n\t\t_panda.anchor.set(0.5);\n\t\t_container.addChild(_panda);\n\n\t\t_count = 0;\n\t\t_switchy = false;\n\t\t_container.filters = [_filter];\n\n\t\tstage.on(\"click\", _onClick);\n\t\tstage.on(\"tap\", _onClick);\n\n\t\tvar style:DefaultStyle = {fontSize: \"12\", fontFamily:\"Arial\", fontWeight: \"bold\", fill: 0xFFFFFF};\n\t\tvar help = new Text(\"Click to turn filters on / off.\", style);\n\t\tstage.addChild(help);\n\t}\n\n\tfunction _init() {\n\t\tposition = \"fixed\";\n\t\tbackgroundColor = 0x00FF66;\n\t\tonUpdate = _onUpdate;\n\t\tsuper.start();\n\t}\n\n\tfunction _onUpdate(elapsedTime:Float) {\n\t\t_count += 0.01;\n\n\t\t_bg.rotation += 0.01;\n\t\t_bgFront.rotation -= 0.01;\n\n\t\t_light1.rotation += 0.02;\n\t\t_light2.rotation += 0.01;\n\n\t\t_panda.scale.x = 1 + Math.sin(_count) * 0.04;\n\t\t_panda.scale.y = 1 + Math.cos(_count) * 0.04;\n\n\t\t_count += 0.1;\n\n\t\t_colorMatrix[1] = Math.sin(_count) * 3;\n\t\t_colorMatrix[2] = Math.cos(_count);\n\t\t_colorMatrix[3] = Math.cos(_count) * 1.5;\n\t\t_colorMatrix[4] = Math.sin(_count / 3) * 2;\n\t\t_colorMatrix[5] = Math.sin(_count / 2);\n\t\t_colorMatrix[6] = Math.sin(_count / 4);\n\t\t_filter.matrix = _colorMatrix;\n\t}\n\n\tfunction _onClick(data:EventTarget) {\n\t\t_switchy = !_switchy;\n\t\tif (!_switchy) _container.filters = [_filter];\n\t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AAS,EAAS,AAAK;EACzC,DAAa,EAAK,FAAS,EAAS;EACpC,DAAa,EAAK,FAAS,EAAS;EACpC,CAAiB;;UAGlB,KAAoC;EACnC,CAAW,FAAC;EACZ,AAAI,DAAC,AAAU,EAAqB,FAAC,KAChC,HAAqB;;;;;4BHpGkB;mBAEN;kBAED;uBACK;uBACA;iBAEN;kBACC;mBACC;mBACA;kBACD;mBACC;oBACC;kBAOZ;;;;"
}
\ No newline at end of file
diff --git a/samples/_output/devicedetection.js b/samples/_output/devicedetection.js
index d508969e..1b5b16c9 100644
--- a/samples/_output/devicedetection.js
+++ b/samples/_output/devicedetection.js
@@ -171,7 +171,6 @@ Std.string = function(s) {
var pixi_plugins_app_Application = function() {
this._animationFrameId = null;
this.pixelRatio = 1;
- this.set_skipFrame(false);
this.autoResize = true;
this.transparent = false;
this.antialias = false;
@@ -183,22 +182,10 @@ var pixi_plugins_app_Application = function() {
this.width = window.innerWidth;
this.height = window.innerHeight;
this.position = "static";
- this.set_fps(60);
};
pixi_plugins_app_Application.__name__ = true;
pixi_plugins_app_Application.prototype = {
- set_fps: function(val) {
- this._frameCount = 0;
- return val >= 1 && val < 60?this.fps = val | 0:this.fps = 60;
- }
- ,set_skipFrame: function(val) {
- if(val) {
- console.log("pixi.plugins.app.Application > Deprecated: skipFrame - use fps property and set it to 30 instead");
- this.set_fps(30);
- }
- return this.skipFrame = val;
- }
- ,start: function(rendererType,parentDom,canvasElement) {
+ start: function(rendererType,parentDom,canvasElement) {
if(rendererType == null) rendererType = "auto";
if(canvasElement == null) {
var _this = window.document;
@@ -207,8 +194,7 @@ pixi_plugins_app_Application.prototype = {
this.canvas.style.height = this.height + "px";
this.canvas.style.position = this.position;
} else this.canvas = canvasElement;
- if(parentDom == null) window.document.body.appendChild(this.canvas); else parentDom.appendChild(this.canvas);
- this.stage = new PIXI.Container();
+ if(this.autoResize) window.onresize = $bind(this,this._onWindowResize);
var renderingOptions = { };
renderingOptions.view = this.canvas;
renderingOptions.backgroundColor = this.backgroundColor;
@@ -219,35 +205,33 @@ pixi_plugins_app_Application.prototype = {
renderingOptions.transparent = this.transparent;
renderingOptions.clearBeforeRender = this.clearBeforeRender;
renderingOptions.preserveDrawingBuffer = this.preserveDrawingBuffer;
- if(rendererType == "auto") this.renderer = PIXI.autoDetectRenderer(this.width,this.height,renderingOptions); else if(rendererType == "canvas") this.renderer = new PIXI.CanvasRenderer(this.width,this.height,renderingOptions); else this.renderer = new PIXI.WebGLRenderer(this.width,this.height,renderingOptions);
- if(this.roundPixels) this.renderer.roundPixels = true;
- if(parentDom == null) window.document.body.appendChild(this.renderer.view); else parentDom.appendChild(this.renderer.view);
- this.resumeRendering();
+ renderingOptions.roundPixels = this.roundPixels;
+ if(rendererType != null) switch(rendererType) {
+ case "canvas":
+ this.app = new PIXI.Application(this.width,this.height,renderingOptions,true);
+ break;
+ default:
+ this.app = new PIXI.Application(this.width,this.height,renderingOptions);
+ } else this.app = new PIXI.Application(this.width,this.height,renderingOptions);
+ this.stage = this.app.stage;
+ this.renderer = this.app.renderer;
+ if(parentDom == null) window.document.body.appendChild(this.app.view); else parentDom.appendChild(this.app.view);
+ this.app.ticker.add($bind(this,this._onRequestAnimationFrame));
this.addStats();
}
- ,resumeRendering: function() {
- if(this.autoResize) window.onresize = $bind(this,this._onWindowResize);
- if(this._animationFrameId == null) this._animationFrameId = window.requestAnimationFrame($bind(this,this._onRequestAnimationFrame));
- }
,_onWindowResize: function(event) {
this.width = window.innerWidth;
this.height = window.innerHeight;
- this.renderer.resize(this.width,this.height);
+ this.app.renderer.resize(this.width,this.height);
this.canvas.style.width = this.width + "px";
this.canvas.style.height = this.height + "px";
if(this.onResize != null) this.onResize();
}
- ,_onRequestAnimationFrame: function(elapsedTime) {
- this._frameCount++;
- if(this._frameCount == (60 / this.fps | 0)) {
- this._frameCount = 0;
- if(this.onUpdate != null) this.onUpdate(elapsedTime);
- this.renderer.render(this.stage);
- }
- this._animationFrameId = window.requestAnimationFrame($bind(this,this._onRequestAnimationFrame));
+ ,_onRequestAnimationFrame: function() {
+ if(this.onUpdate != null) this.onUpdate(this.app.ticker.deltaTime);
}
,addStats: function() {
- if(window.Perf != null) new Perf().addInfo(["UNKNOWN","WEBGL","CANVAS"][this.renderer.type] + " - " + this.pixelRatio);
+ if(window.Perf != null) new Perf().addInfo(["UNKNOWN","WEBGL","CANVAS"][this.app.renderer.type] + " - " + this.pixelRatio);
}
};
var devicedetection_Main = function() {
diff --git a/samples/_output/devicedetection.js.map b/samples/_output/devicedetection.js.map
index 5673f9f5..eb2f2d7a 100644
--- a/samples/_output/devicedetection.js.map
+++ b/samples/_output/devicedetection.js.map
@@ -3,7 +3,7 @@
"file":"devicedetection.js",
"sourceRoot":"file:///",
"sources":["/usr/local/lib/haxe/std/js/_std/EReg.hx","/projects/pixi-haxe/.haxelib/perf,js/1,1,8/src/Perf.hx","/usr/local/lib/haxe/std/js/_std/Reflect.hx","/usr/local/lib/haxe/std/js/_std/Std.hx","/projects/pixi-haxe/src/pixi/plugins/app/Application.hx","/projects/pixi-haxe/samples/devicedetection/Main.hx","/usr/local/lib/haxe/std/js/Boot.hx"],
-"sourcesContent":["/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class EReg {\n\n\tvar r : HaxeRegExp;\n\n\tpublic function new( r : String, opt : String ) : Void {\n\t\topt = opt.split(\"u\").join(\"\"); // 'u' (utf8) depends on page encoding\n\t\tthis.r = new HaxeRegExp(r, opt);\n\t}\n\n\tpublic function match( s : String ) : Bool {\n\t\tif( r.global ) r.lastIndex = 0;\n\t\tr.m = r.exec(s);\n\t\tr.s = s;\n\t\treturn (r.m != null);\n\t}\n\n\tpublic function matched( n : Int ) : String {\n\t\treturn if( r.m != null && n >= 0 && n < r.m.length ) r.m[n] else throw \"EReg::matched\";\n\t}\n\n\tpublic function matchedLeft() : String {\n\t\tif( r.m == null ) throw \"No string matched\";\n\t\treturn r.s.substr(0,r.m.index);\n\t}\n\n\tpublic function matchedRight() : String {\n\t\tif( r.m == null ) throw \"No string matched\";\n\t\tvar sz = r.m.index+r.m[0].length;\n\t\treturn r.s.substr(sz,r.s.length-sz);\n\t}\n\n\tpublic function matchedPos() : { pos : Int, len : Int } {\n\t\tif( r.m == null ) throw \"No string matched\";\n\t\treturn { pos : r.m.index, len : r.m[0].length };\n\t}\n\n\tpublic function matchSub( s : String, pos : Int, len : Int = -1):Bool {\n\t\treturn if (r.global) {\n\t\t\tr.lastIndex = pos;\n\t\t\tr.m = r.exec(len < 0 ? s : s.substr(0, pos + len));\n\t\t\tvar b = r.m != null;\n\t\t\tif (b) {\n\t\t\t\tr.s = s;\n\t\t\t}\n\t\t\tb;\n\t\t} else {\n\t\t\t// TODO: check some ^/$ related corner cases\n\t\t\tvar b = match( len < 0 ? s.substr(pos) : s.substr(pos,len) );\n\t\t\tif (b) {\n\t\t\t\tr.s = s;\n\t\t\t\tr.m.index += pos;\n\t\t\t}\n\t\t\tb;\n\t\t}\n\t}\n\n\tpublic function split( s : String ) : Array {\n\t\t// we can't use directly s.split because it's ignoring the 'g' flag\n\t\tvar d = \"#__delim__#\";\n\t\treturn untyped s.replace(r,d).split(d);\n\t}\n\n\tpublic function replace( s : String, by : String ) : String {\n\t\treturn untyped s.replace(r,by);\n\t}\n\n\tpublic function map( s : String, f : EReg -> String ) : String {\n\t\tvar offset = 0;\n\t\tvar buf = new StringBuf();\n\t\tdo {\n\t\t\tif (offset >= s.length)\n\t\t\t\tbreak;\n\t\t\telse if (!matchSub(s, offset)) {\n\t\t\t\tbuf.add(s.substr(offset));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvar p = matchedPos();\n\t\t\tbuf.add(s.substr(offset, p.pos - offset));\n\t\t\tbuf.add(f(this));\n\t\t\tif (p.len == 0) {\n\t\t\t\tbuf.add(s.substr(p.pos, 1));\n\t\t\t\toffset = p.pos + 1;\n\t\t\t}\n\t\t\telse\n\t\t\t\toffset = p.pos + p.len;\n\t\t} while (r.global);\n\t\tif (!r.global && offset > 0 && offset < s.length)\n\t\t\tbuf.add(s.substr(offset));\n\t\treturn buf.toString();\n\t}\n}\n\n@:native(\"RegExp\")\nprivate extern class HaxeRegExp extends js.RegExp {\n\tvar m:js.RegExp.RegExpMatch;\n\tvar s:String;\n}\n","import js.html.Performance;\nimport js.html.DivElement;\nimport js.Browser;\n\n@:expose class Perf {\n\n\tpublic static var MEASUREMENT_INTERVAL:Int = 1000;\n\n\tpublic static var FONT_FAMILY:String = \"Helvetica,Arial\";\n\n\tpublic static var FPS_BG_CLR:String = \"#00FF00\";\n\tpublic static var FPS_WARN_BG_CLR:String = \"#FF8000\";\n\tpublic static var FPS_PROB_BG_CLR:String = \"#FF0000\";\n\n\tpublic static var MS_BG_CLR:String = \"#FFFF00\";\n\tpublic static var MEM_BG_CLR:String = \"#086A87\";\n\tpublic static var INFO_BG_CLR:String = \"#00FFFF\";\n\tpublic static var FPS_TXT_CLR:String = \"#000000\";\n\tpublic static var MS_TXT_CLR:String = \"#000000\";\n\tpublic static var MEM_TXT_CLR:String = \"#FFFFFF\";\n\tpublic static var INFO_TXT_CLR:String = \"#000000\";\n\n\tpublic static var TOP_LEFT:String = \"TL\";\n\tpublic static var TOP_RIGHT:String = \"TR\";\n\tpublic static var BOTTOM_LEFT:String = \"BL\";\n\tpublic static var BOTTOM_RIGHT:String = \"BR\";\n\n\tstatic var DELAY_TIME:Int = 4000;\n\n\tpublic var fps:DivElement;\n\tpublic var ms:DivElement;\n\tpublic var memory:DivElement;\n\tpublic var info:DivElement;\n\n\tpublic var lowFps:Float;\n\tpublic var avgFps:Float;\n\tpublic var currentFps:Float;\n\tpublic var currentMs:Float;\n\tpublic var currentMem:String;\n\n\tvar _time:Float;\n\tvar _startTime:Float;\n\tvar _prevTime:Float;\n\tvar _ticks:Int;\n\tvar _fpsMin:Float;\n\tvar _fpsMax:Float;\n\tvar _memCheck:Bool;\n\tvar _pos:String;\n\tvar _offset:Float;\n\tvar _measureCount:Int;\n\tvar _totalFps:Float;\n\n\tvar _perfObj:Performance;\n\tvar _memoryObj:Memory;\n\tvar _raf:Int;\n\n\tvar RAF:Dynamic;\n\tvar CAF:Dynamic;\n\n\tpublic function new(?pos = \"TR\", ?offset:Float = 0) {\n\t\t_perfObj = Browser.window.performance;\n\t\tif (Reflect.field(_perfObj, \"memory\") != null) _memoryObj = Reflect.field(_perfObj, \"memory\");\n\t\t_memCheck = (_perfObj != null && _memoryObj != null && _memoryObj.totalJSHeapSize > 0);\n\n\t\t_pos = pos;\n\t\t_offset = offset;\n\n\t\t_init();\n\t\t_createFpsDom();\n\t\t_createMsDom();\n\t\tif (_memCheck) _createMemoryDom();\n\n\t\tif (Browser.window.requestAnimationFrame != null) RAF = Browser.window.requestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozRequestAnimationFrame != null) RAF = untyped __js__(\"window\").mozRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitRequestAnimationFrame != null) RAF = untyped __js__(\"window\").webkitRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msRequestAnimationFrame != null) RAF = untyped __js__(\"window\").msRequestAnimationFrame;\n\n\t\tif (Browser.window.cancelAnimationFrame != null) CAF = Browser.window.cancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozCancelAnimationFrame != null) CAF = untyped __js__(\"window\").mozCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitCancelAnimationFrame != null) CAF = untyped __js__(\"window\").webkitCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msCancelAnimationFrame != null) CAF = untyped __js__(\"window\").msCancelAnimationFrame;\n\n\t\tif (RAF != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tinline function _init() {\n\t\tcurrentFps = 60;\n\t\tcurrentMs = 0;\n\t\tcurrentMem = \"0\";\n\n\t\tlowFps = 60;\n\t\tavgFps = 60;\n\n\t\t_measureCount = 0;\n\t\t_totalFps = 0;\n\t\t_time = 0;\n\t\t_ticks = 0;\n\t\t_fpsMin = 60;\n\t\t_fpsMax = 60;\n\t\t_startTime = _now();\n\t\t_prevTime = -MEASUREMENT_INTERVAL;\n\t}\n\n\tinline function _now():Float {\n\t\treturn (_perfObj != null && _perfObj.now != null) ? _perfObj.now() : Date.now().getTime();\n\t}\n\n\tfunction _tick(val:Float) {\n\t\tvar time = _now();\n\t\t_ticks++;\n\n\t\tif (_raf != null && time > _prevTime + MEASUREMENT_INTERVAL) {\n\t\t\tcurrentMs = Math.round(time - _startTime);\n\t\t\tms.innerHTML = \"MS: \" + currentMs;\n\n\t\t\tcurrentFps = Math.round((_ticks * 1000) / (time - _prevTime));\n\t\t\tif (currentFps > 0 && val > DELAY_TIME) {\n\t\t\t\t_measureCount++;\n\t\t\t\t_totalFps += currentFps;\n\t\t\t\tlowFps = _fpsMin = Math.min(_fpsMin, currentFps);\n\t\t\t\t_fpsMax = Math.max(_fpsMax, currentFps);\n\t\t\t\tavgFps = Math.round(_totalFps / _measureCount);\n\t\t\t}\n\n\t\t\tfps.innerHTML = \"FPS: \" + currentFps + \" (\" + _fpsMin + \"-\" + _fpsMax + \")\";\n\n\t\t\tif (currentFps >= 30) fps.style.backgroundColor = FPS_BG_CLR;\n\t\t\telse if (currentFps >= 15) fps.style.backgroundColor = FPS_WARN_BG_CLR;\n\t\t\telse fps.style.backgroundColor = FPS_PROB_BG_CLR;\n\n\t\t\t_prevTime = time;\n\t\t\t_ticks = 0;\n\n\t\t\tif (_memCheck) {\n\t\t\t\tcurrentMem = _getFormattedSize(_memoryObj.usedJSHeapSize, 2);\n\t\t\t\tmemory.innerHTML = \"MEM: \" + currentMem;\n\t\t\t}\n\t\t}\n\t\t_startTime = time;\n\n\t\tif (_raf != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tfunction _createDiv(id:String, ?top:Float = 0):DivElement {\n\t\tvar div:DivElement = Browser.document.createDivElement();\n\t\tdiv.id = id;\n\t\tdiv.className = id;\n\t\tdiv.style.position = \"absolute\";\n\n\t\tswitch (_pos) {\n\t\t\tcase \"TL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"TR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"BL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t\tcase \"BR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t}\n\n\t\tdiv.style.width = \"80px\";\n\t\tdiv.style.height = \"12px\";\n\t\tdiv.style.lineHeight = \"12px\";\n\t\tdiv.style.padding = \"2px\";\n\t\tdiv.style.fontFamily = FONT_FAMILY;\n\t\tdiv.style.fontSize = \"9px\";\n\t\tdiv.style.fontWeight = \"bold\";\n\t\tdiv.style.textAlign = \"center\";\n\t\tBrowser.document.body.appendChild(div);\n\t\treturn div;\n\t}\n\n\tfunction _createFpsDom() {\n\t\tfps = _createDiv(\"fps\");\n\t\tfps.style.backgroundColor = FPS_BG_CLR;\n\t\tfps.style.zIndex = \"995\";\n\t\tfps.style.color = FPS_TXT_CLR;\n\t\tfps.innerHTML = \"FPS: 0\";\n\t}\n\n\tfunction _createMsDom() {\n\t\tms = _createDiv(\"ms\", 16);\n\t\tms.style.backgroundColor = MS_BG_CLR;\n\t\tms.style.zIndex = \"996\";\n\t\tms.style.color = MS_TXT_CLR;\n\t\tms.innerHTML = \"MS: 0\";\n\t}\n\n\tfunction _createMemoryDom() {\n\t\tmemory = _createDiv(\"memory\", 32);\n\t\tmemory.style.backgroundColor = MEM_BG_CLR;\n\t\tmemory.style.color = MEM_TXT_CLR;\n\t\tmemory.style.zIndex = \"997\";\n\t\tmemory.innerHTML = \"MEM: 0\";\n\t}\n\n\tfunction _getFormattedSize(bytes:Float, ?frac:Int = 0):String {\n\t\tvar sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n\t\tif (bytes == 0) return \"0\";\n\t\tvar precision = Math.pow(10, frac);\n\t\tvar i = Math.floor(Math.log(bytes) / Math.log(1024));\n\t\treturn Math.round(bytes * precision / Math.pow(1024, i)) / precision + \" \" + sizes[i];\n\t}\n\n\tpublic function addInfo(val:String) {\n\t\tinfo = _createDiv(\"info\", (_memCheck) ? 48 : 32);\n\t\tinfo.style.backgroundColor = INFO_BG_CLR;\n\t\tinfo.style.color = INFO_TXT_CLR;\n\t\tinfo.style.zIndex = \"998\";\n\t\tinfo.innerHTML = val;\n\t}\n\n\tpublic function clearInfo() {\n\t\tif (info != null) {\n\t\t\tBrowser.document.body.removeChild(info);\n\t\t\tinfo = null;\n\t\t}\n\t}\n\n\tpublic function destroy() {\n\t\t_cancelRAF();\n\t\t_perfObj = null;\n\t\t_memoryObj = null;\n\t\tif (fps != null) {\n\t\t\tBrowser.document.body.removeChild(fps);\n\t\t\tfps = null;\n\t\t}\n\t\tif (ms != null) {\n\t\t\tBrowser.document.body.removeChild(ms);\n\t\t\tms = null;\n\t\t}\n\t\tif (memory != null) {\n\t\t\tBrowser.document.body.removeChild(memory);\n\t\t\tmemory = null;\n\t\t}\n\t\tclearInfo();\n\t\t_init();\n\t}\n\n\tinline function _cancelRAF() {\n\t\tReflect.callMethod(Browser.window, CAF, [_raf]);\n\t\t_raf = null;\n\t}\n}\n\ntypedef Memory = {\n\tvar usedJSHeapSize:Float;\n\tvar totalJSHeapSize:Float;\n\tvar jsHeapSizeLimit:Float;\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class Reflect {\n\n\tpublic inline static function hasField( o : Dynamic, field : String ) : Bool {\n\t\treturn untyped __js__('Object').prototype.hasOwnProperty.call(o, field);\n\t}\n\n\tpublic static function field( o : Dynamic, field : String ) : Dynamic {\n\t\ttry return untyped o[field] catch( e : Dynamic ) return null;\n\t}\n\n\tpublic inline static function setField( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\to[field] = value;\n\t}\n\n\tpublic static inline function getProperty( o : Dynamic, field : String ) : Dynamic untyped {\n\t\tvar tmp;\n\t\treturn if( o == null ) __define_feature__(\"Reflect.getProperty\",null) else if( o.__properties__ && (tmp=o.__properties__[\"get_\"+field]) ) o[tmp]() else o[field];\n\t}\n\n\tpublic static inline function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\tvar tmp;\n\t\tif( o.__properties__ && (tmp=o.__properties__[\"set_\"+field]) ) o[tmp](value) else o[field] = __define_feature__(\"Reflect.setProperty\",value);\n\t}\n\n\tpublic inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array ) : Dynamic untyped {\n\t\treturn func.apply(o,args);\n\t}\n\n\tpublic static function fields( o : Dynamic ) : Array {\n\t\tvar a = [];\n\t\tif (o != null) untyped {\n\t\t\tvar hasOwnProperty = __js__('Object').prototype.hasOwnProperty;\n\t\t\t__js__(\"for( var f in o ) {\");\n\t\t\tif( f != \"__id__\" && f != \"hx__closures__\" && hasOwnProperty.call(o, f) ) a.push(f);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static function isFunction( f : Dynamic ) : Bool untyped {\n\t\treturn __js__(\"typeof(f)\") == \"function\" && !(js.Boot.isClass(f) || js.Boot.isEnum(f));\n\t}\n\n\tpublic static function compare( a : T, b : T ) : Int {\n\t\treturn ( a == b ) ? 0 : (((cast a) > (cast b)) ? 1 : -1);\n\t}\n\n\tpublic static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool {\n\t\tif( f1 == f2 )\n\t\t\treturn true;\n\t\tif( !isFunction(f1) || !isFunction(f2) )\n\t\t\treturn false;\n\t\treturn f1.scope == f2.scope && f1.method == f2.method && f1.method != null;\n\t}\n\n\tpublic static function isObject( v : Dynamic ) : Bool untyped {\n\t\tif( v == null )\n\t\t\treturn false;\n\t\tvar t = __js__(\"typeof(v)\");\n\t\treturn (t == \"string\" || (t == \"object\" && v.__enum__ == null)) || (t == \"function\" && (js.Boot.isClass(v) || js.Boot.isEnum(v)) != null);\n\t}\n\n\tpublic static function isEnumValue( v : Dynamic ) : Bool {\n\t\treturn v != null && v.__enum__ != null;\n\t}\n\n\tpublic static function deleteField( o : Dynamic, field : String ) : Bool untyped {\n\t\tif( !hasField(o,field) ) return false;\n\t\t__js__(\"delete\")(o[field]);\n\t\treturn true;\n\t}\n\n\tpublic static function copy( o : T ) : T {\n\t\tvar o2 : Dynamic = {};\n\t\tfor( f in Reflect.fields(o) )\n\t\t\tReflect.setField(o2,f,Reflect.field(o,f));\n\t\treturn o2;\n\t}\n\n\t@:overload(function( f : Array -> Void ) : Dynamic {})\n\tpublic static function makeVarArgs( f : Array -> Dynamic ) : Dynamic {\n\t\treturn function() {\n\t\t\tvar a = untyped Array.prototype.slice.call(__js__(\"arguments\"));\n\t\t\treturn f(a);\n\t\t};\n\t}\n\n}\n","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport js.Boot;\n\n@:keepInit\n@:coreApi class Std {\n\n\tpublic static inline function is( v : Dynamic, t : Dynamic ) : Bool {\n\t\treturn untyped js.Boot.__instanceof(v,t);\n\t}\n\n\tpublic static inline function instance( value : T, c : Class ) : S {\n\t\treturn untyped __instanceof__(value, c) ? cast value : null;\n\t}\n\n\tpublic static function string( s : Dynamic ) : String {\n\t\treturn untyped js.Boot.__string_rec(s,\"\");\n\t}\n\n\tpublic static inline function int( x : Float ) : Int {\n\t\treturn (cast x) | 0;\n\t}\n\n\tpublic static function parseInt( x : String ) : Null {\n\t\tvar v = untyped __js__(\"parseInt\")(x, 10);\n\t\t// parse again if hexadecimal\n\t\tif( v == 0 && (x.charCodeAt(1) == 'x'.code || x.charCodeAt(1) == 'X'.code) )\n\t\t\tv = untyped __js__(\"parseInt\")(x);\n\t\tif( untyped __js__(\"isNaN\")(v) )\n\t\t\treturn null;\n\t\treturn cast v;\n\t}\n\n\tpublic static inline function parseFloat( x : String ) : Float {\n\t\treturn untyped __js__(\"parseFloat\")(x);\n\t}\n\n\tpublic static function random( x : Int ) : Int {\n\t\treturn untyped x <= 0 ? 0 : Math.floor(Math.random()*x);\n\t}\n\n\tstatic function __init__() : Void untyped {\n\t\t__feature__(\"js.Boot.getClass\",String.prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"String\"] = String,String));\n\t\t__feature__(\"js.Boot.isClass\",String.__name__ = __feature__(\"Type.getClassName\",[\"String\"],true));\n\t\t__feature__(\"Type.resolveClass\",$hxClasses[\"Array\"] = Array);\n\t\t__feature__(\"js.Boot.isClass\",Array.__name__ = __feature__(\"Type.getClassName\",[\"Array\"],true));\n\t\t__feature__(\"Date.*\", {\n\t\t\t__feature__(\"js.Boot.getClass\",__js__('Date').prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"Date\"] = __js__('Date'),__js__('Date')));\n\t\t\t__feature__(\"js.Boot.isClass\",__js__('Date').__name__ = [\"Date\"]);\n\t\t});\n\t\t__feature__(\"Int.*\",{\n\t\t\tvar Int = __feature__(\"Type.resolveClass\", $hxClasses[\"Int\"] = { __name__ : [\"Int\"] }, { __name__ : [\"Int\"] });\n\t\t});\n\t\t__feature__(\"Dynamic.*\",{\n\t\t\tvar Dynamic = __feature__(\"Type.resolveClass\", $hxClasses[\"Dynamic\"] = { __name__ : [\"Dynamic\"] }, { __name__ : [\"Dynamic\"] });\n\t\t});\n\t\t__feature__(\"Float.*\",{\n\t\t\tvar Float = __feature__(\"Type.resolveClass\", $hxClasses[\"Float\"] = __js__(\"Number\"), __js__(\"Number\"));\n\t\t\tFloat.__name__ = [\"Float\"];\n\t\t});\n\t\t__feature__(\"Bool.*\",{\n\t\t\tvar Bool = __feature__(\"Type.resolveEnum\",$hxClasses[\"Bool\"] = __js__(\"Boolean\"), __js__(\"Boolean\"));\n\t\t\tBool.__ename__ = [\"Bool\"];\n\t\t});\n\t\t__feature__(\"Class.*\",{\n\t\t\tvar Class = __feature__(\"Type.resolveClass\", $hxClasses[\"Class\"] = { __name__ : [\"Class\"] }, { __name__ : [\"Class\"] });\n\t\t});\n\t\t__feature__(\"Enum.*\",{\n\t\t\tvar Enum = {};\n\t\t});\n\t\t__feature__(\"Void.*\",{\n\t\t\tvar Void = __feature__(\"Type.resolveEnum\", $hxClasses[\"Void\"] = { __ename__ : [\"Void\"] }, { __ename__ : [\"Void\"] });\n\t\t});\n\n#if !js_es5\n\t\t__feature__(\"Array.map\",\n\t\t\tif( Array.prototype.map == null )\n\t\t\t\tArray.prototype.map = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length )\n\t\t\t\t\t\ta[i] = f(__this__[i]);\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n\t\t__feature__(\"Array.filter\",\n\t\t\tif( Array.prototype.filter == null )\n\t\t\t\tArray.prototype.filter = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length ) {\n\t\t\t\t\t\tvar e = __this__[i];\n\t\t\t\t\t\tif( f(e) ) a.push(e);\n\t\t\t\t\t}\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n#end\n\t}\n\n}\n","package pixi.plugins.app;\n\nimport pixi.core.renderers.webgl.WebGLRenderer;\nimport pixi.core.renderers.canvas.CanvasRenderer;\nimport pixi.core.renderers.Detector;\nimport pixi.core.display.Container;\nimport js.html.Event;\nimport js.html.Element;\nimport js.html.CanvasElement;\nimport js.Browser;\n\n/**\n * Pixi Boilerplate Helper class that can be used by any application\n * @author Adi Reddy Mora\n * http://adireddy.github.io\n * @license MIT\n * @copyright 2015\n */\nclass Application {\n\n\t/**\n * Sets the pixel ratio of the application.\n * default - 1\n */\n\tpublic var pixelRatio:Float;\n\n\t/**\n\t * Default frame rate is 60 FPS and this can be set to true to get 30 FPS.\n\t * default - false\n\t */\n\tpublic var skipFrame(default, set):Bool;\n\n\t/**\n\t * Default frame rate is 60 FPS and this can be set to anything between 1 - 60.\n\t * default - 60\n\t */\n\tpublic var fps(default, set):Int;\n\n\t/**\n\t * Width of the application.\n\t * default - Browser.window.innerWidth\n\t */\n\tpublic var width:Float;\n\n\t/**\n\t * Height of the application.\n\t * default - Browser.window.innerHeight\n\t */\n\tpublic var height:Float;\n\n\t/**\n\t * Position of canvas element\n\t * default - static\n\t */\n\tpublic var position:String;\n\n\t/**\n\t * Renderer transparency property.\n\t * default - false\n\t */\n\tpublic var transparent:Bool;\n\n\t/**\n\t * Graphics antialias property.\n\t * default - false\n\t */\n\tpublic var antialias:Bool;\n\n\t/**\n\t * Force FXAA shader antialias instead of native (faster).\n\t * default - false\n\t */\n\tpublic var forceFXAA:Bool;\n\n\t/**\n\t * Force round pixels.\n\t * default - false\n\t */\n\tpublic var roundPixels:Bool;\n\n\t/**\n\t * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.\n * If the scene is transparent Pixi will use clearRect to clear the canvas every frame.\n * Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.\n\t * default - true\n\t */\n\tpublic var clearBeforeRender:Bool;\n\n\t/**\n\t * enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context\n\t * default - false\n\t */\n\tpublic var preserveDrawingBuffer:Bool;\n\n\t/**\n\t * Whether you want to resize the canvas and renderer on browser resize.\n\t * Should be set to false when custom width and height are used for the application.\n\t * default - true\n\t */\n\tpublic var autoResize:Bool;\n\n\t/**\n\t * Sets the background color of the stage.\n\t * default - 0xFFFFFF\n\t */\n\tpublic var backgroundColor:Int;\n\n\t/**\n\t * Update listener \tfunction\n\t */\n\tpublic var onUpdate:Float -> Void;\n\n\t/**\n\t * Window resize listener \tfunction\n\t */\n\tpublic var onResize:Void -> Void;\n\n\t/**\n\t * Canvas Element\n\t * Read-only\n\t */\n\tpublic var canvas(default, null):CanvasElement;\n\n\t/**\n\t * Renderer\n\t * Read-only\n\t */\n\tpublic var renderer(default, null):Dynamic;\n\n\t/**\n\t * Global Container.\n\t * Read-only\n\t */\n\tpublic var stage(default, null):Container;\n\n\tpublic static inline var AUTO:String = \"auto\";\n\tpublic static inline var RECOMMENDED:String = \"recommended\";\n\tpublic static inline var CANVAS:String = \"canvas\";\n\tpublic static inline var WEBGL:String = \"webgl\";\n\n\tvar _frameCount:Int;\n\tvar _animationFrameId:Null;\n\n\tpublic function new() {\n\t\t_setDefaultValues();\n\t}\n\n\tfunction set_fps(val:Int):Int {\n\t\t_frameCount = 0;\n\t\treturn fps = (val >= 1 && val < 60) ? Std.int(val) : 60;\n\t}\n\n\tfunction set_skipFrame(val:Bool):Bool {\n\t\tif (val) {\n\t\t\ttrace(\"pixi.plugins.app.Application > Deprecated: skipFrame - use fps property and set it to 30 instead\");\n\t\t\tfps = 30;\n\t\t}\n\t\treturn skipFrame = val;\n\t}\n\n\tinline function _setDefaultValues() {\n\t\t_animationFrameId = null;\n\t\tpixelRatio = 1;\n\t\tskipFrame = false;\n\t\tautoResize = true;\n\t\ttransparent = false;\n\t\tantialias = false;\n\t\tforceFXAA = false;\n\t\troundPixels = false;\n\t\tclearBeforeRender = true;\n\t\tpreserveDrawingBuffer = false;\n\t\tbackgroundColor = 0xFFFFFF;\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tposition = \"static\";\n\t\tfps = 60;\n\t}\n\n\t/**\n\t * Starts pixi application setup using the properties set or default values\n\t * @param [rendererType] - Renderer type to use AUTO (default) | CANVAS | WEBGL\n\t * @param [stats] - Enable/disable stats for the application.\n\t * Note that stats.js is not part of pixi so don't forget to include it you html page\n\t * Can be found in libs folder. \"libs/stats.min.js\" \n\t * @param [parentDom] - By default canvas will be appended to body or it can be appended to custom element if passed\n\t */\n\n\tpublic function start(?rendererType:String = \"auto\", ?parentDom:Element, ?canvasElement:CanvasElement) {\n\t\tif (canvasElement == null) {\n\t\t\tcanvas = Browser.document.createCanvasElement();\n\t\t\tcanvas.style.width = width + \"px\";\n\t\t\tcanvas.style.height = height + \"px\";\n\t\t\tcanvas.style.position = position;\n\t\t}\n\t\telse canvas = canvasElement;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(canvas);\n\t\telse parentDom.appendChild(canvas);\n\n\t\tstage = new Container();\n\n\t\tvar renderingOptions:RenderingOptions = {};\n\t\trenderingOptions.view = canvas;\n\t\trenderingOptions.backgroundColor = backgroundColor;\n\t\trenderingOptions.resolution = pixelRatio;\n\t\trenderingOptions.antialias = antialias;\n\t\trenderingOptions.forceFXAA = forceFXAA;\n\t\trenderingOptions.autoResize = autoResize;\n\t\trenderingOptions.transparent = transparent;\n\t\trenderingOptions.clearBeforeRender = clearBeforeRender;\n\t\trenderingOptions.preserveDrawingBuffer = preserveDrawingBuffer;\n\n\t\tif (rendererType == AUTO) renderer = Detector.autoDetectRenderer(width, height, renderingOptions);\n\t\telse if (rendererType == CANVAS) renderer = new CanvasRenderer(width, height, renderingOptions);\n\t\telse renderer = new WebGLRenderer(width, height, renderingOptions);\n\n\t\tif (roundPixels) renderer.roundPixels = true;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(renderer.view);\n\t\telse parentDom.appendChild(renderer.view);\n\t\tresumeRendering();\n\t\t#if stats addStats(); #end\n\t}\n\n\tpublic function pauseRendering() {\n\t\tBrowser.window.onresize = null;\n\t\tif (_animationFrameId != null) {\n\t\t\tBrowser.window.cancelAnimationFrame(_animationFrameId);\n\t\t\t_animationFrameId = null;\n\t\t}\n\t}\n\n\tpublic function resumeRendering() {\n\t\tif (autoResize) Browser.window.onresize = _onWindowResize;\n\t\tif (_animationFrameId == null) _animationFrameId = Browser.window.requestAnimationFrame(_onRequestAnimationFrame);\n\t}\n\n\t@:noCompletion function _onWindowResize(event:Event) {\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\trenderer.resize(width, height);\n\t\tcanvas.style.width = width + \"px\";\n\t\tcanvas.style.height = height + \"px\";\n\n\t\tif (onResize != null) onResize();\n\t}\n\n\t@:noCompletion function _onRequestAnimationFrame(elapsedTime:Float) {\n\t\t_frameCount++;\n\t\tif (_frameCount == Std.int(60 / fps)) {\n\t\t\t_frameCount = 0;\n\t\t\tif (onUpdate != null) onUpdate(elapsedTime);\n\t\t\trenderer.render(stage);\n\t\t}\n\t\t_animationFrameId = Browser.window.requestAnimationFrame(_onRequestAnimationFrame);\n\t}\n\n\tpublic function addStats() {\n\t\tif (untyped __js__(\"window\").Perf != null) {\n\t\t\tnew Perf().addInfo([\"UNKNOWN\", \"WEBGL\", \"CANVAS\"][renderer.type] + \" - \" + pixelRatio);\n\t\t}\n\t}\n}","package devicedetection;\n\nimport pixi.core.display.Container;\nimport pixi.core.text.Text;\nimport pixi.plugins.app.Application;\nimport js.Browser;\n\nclass Main extends Application {\n\n\tvar _info:Container;\n\n\tpublic function new() {\n\t\tsuper();\n\t\t_init();\n\t}\n\n\tfunction _init() {\n\t\tbackgroundColor = 0x003366;\n\t\tsuper.start();\n\n\t\t_info = new Container();\n\t\tstage.addChild(_info);\n\n\t\tvar txt = new Text(\"\", {fill: \"#FFFFFF\"});\n\t\ttxt.text = \"Android:\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" + _isAndroid();\n\t\t_info.addChild(txt);\n\n\t\ttxt = new Text(\"\", {fill: \"#FFFFFF\"});\n\t\ttxt.text = \"Android Phone:\\t\\t\\t\\t\\t\" + _isAndroidPhone();\n\t\ttxt.y = 40;\n\t\t_info.addChild(txt);\n\n\t\ttxt = new Text(\"\", {fill: \"#FFFFFF\"});\n\t\ttxt.text = \"iOS:\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" + _isiOS();\n\t\ttxt.y = 80;\n\t\t_info.addChild(txt);\n\n\t\ttxt = new Text(\"\", {fill: \"#FFFFFF\"});\n\t\ttxt.text = \"iOS Phone:\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" + _isiOSPhone();\n\t\ttxt.y = 120;\n\t\t_info.addChild(txt);\n\n\t\ttxt = new Text(\"\", {fill: \"#FFFFFF\"});\n\t\ttxt.text = \"Windows:\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" + _isWindows();\n\t\ttxt.y = 160;\n\t\t_info.addChild(txt);\n\n\t\ttxt = new Text(\"\", {fill: \"#FFFFFF\"});\n\t\ttxt.text = \"Windows Phone:\\t\\t\\t\" + _isWindowsPhone();\n\t\ttxt.y = 200;\n\t\t_info.addChild(txt);\n\n\t\t_info.position.x = (Browser.window.innerWidth - _info.width) / 2;\n\t\t_info.position.y = (Browser.window.innerHeight - _info.height) / 2;\n\t}\n\n\tfunction _isAndroid():Bool {\n\t\treturn ~/Android/i.match(Browser.navigator.userAgent);\n\t}\n\n\tfunction _isAndroidPhone():Bool {\n\t\treturn ~/Android/i.match(Browser.navigator.userAgent) && ~/Mobile/i.match(Browser.navigator.userAgent);\n\t}\n\n\tfunction _isiOS():Bool {\n\t\treturn ~/(iPad|iPhone|iPod)/i.match(Browser.navigator.userAgent);\n\t}\n\n\tfunction _isiOSPhone():Bool {\n\t\treturn ~/(iPhone|iPod)/i.match(Browser.navigator.userAgent);\n\t}\n\n\tfunction _isWindows():Bool {\n\t\treturn ~/(Windows|iemobile)/i.match(Browser.navigator.userAgent);\n\t}\n\n\tfunction _isWindowsPhone():Bool {\n\t\treturn ~/Windows Phone/i.match(Browser.navigator.userAgent) || ~/iemobile/i.match(Browser.navigator.userAgent);\n\t}\n\n\tfunction _getiOSVersion():Array {\n\t\tvar v:EReg = ~/[0-9_]+?[0-9_]+?[0-9_]+/i;\n\t\tvar matched:Array = [];\n\t\tif (v.match(Browser.navigator.userAgent)) {\n\t\t\tvar match:Array = v.matched(0).split(\"_\");\n\t\t\tmatched = [for (i in match) Std.parseInt(i)];\n\t\t}\n\t\treturn matched;\n\t}\n\n\tstatic function main() {\n\t\tnew Main();\n\t}\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\npackage js;\n\nprivate class HaxeError extends js.Error {\n\n\tvar val:Dynamic;\n\n\tpublic function new(val:Dynamic) untyped {\n\t\tsuper();\n\t\tthis.val = __define_feature__(\"js.Boot.HaxeError\", val);\n\t\tthis.message = String(val);\n\t\tif (js.Error.captureStackTrace) js.Error.captureStackTrace(this, HaxeError);\n\t}\n}\n\n@:dox(hide)\nclass Boot {\n\n\tprivate static function __unhtml(s : String) {\n\t\treturn s.split(\"&\").join(\"&\").split(\"<\").join(\"<\").split(\">\").join(\">\");\n\t}\n\n\tprivate static function __trace(v,i : haxe.PosInfos) {\n\t\tuntyped {\n\t\t\tvar msg = if( i != null ) i.fileName+\":\"+i.lineNumber+\": \" else \"\";\n\t\t\t#if jsfl\n\t\t\tmsg += __string_rec(v,\"\");\n\t\t\tfl.trace(msg);\n\t\t\t#else\n\t\t\tmsg += __string_rec(v, \"\");\n\t\t\tif( i != null && i.customParams != null )\n\t\t\t\tfor( v in i.customParams )\n\t\t\t\t\tmsg += \",\" + __string_rec(v, \"\");\n\t\t\tvar d;\n\t\t\tif( __js__(\"typeof\")(document) != \"undefined\" && (d = document.getElementById(\"haxe:trace\")) != null )\n\t\t\t\td.innerHTML += __unhtml(msg)+\"
\";\n\t\t\telse if( __js__(\"typeof console\") != \"undefined\" && __js__(\"console\").log != null )\n\t\t\t\t__js__(\"console\").log(msg);\n\t\t\t#end\n\t\t}\n\t}\n\n\tprivate static function __clear_trace() {\n\t\tuntyped {\n\t\t\t#if jsfl\n\t\t\tfl.outputPanel.clear();\n\t\t\t#else\n\t\t\tvar d = document.getElementById(\"haxe:trace\");\n\t\t\tif( d != null )\n\t\t\t\td.innerHTML = \"\";\n\t\t\t#end\n\t\t}\n\t}\n\n\tstatic inline function isClass(o:Dynamic) : Bool {\n\t\treturn untyped __define_feature__(\"js.Boot.isClass\", o.__name__);\n\t}\n\n\tstatic inline function isEnum(e:Dynamic) : Bool {\n\t\treturn untyped __define_feature__(\"js.Boot.isEnum\", e.__ename__);\n\t}\n\n\tstatic function getClass(o:Dynamic) : Dynamic {\n\t\tif (Std.is(o, Array))\n\t\t\treturn Array;\n\t\telse {\n\t\t\tvar cl = untyped __define_feature__(\"js.Boot.getClass\", o.__class__);\n\t\t\tif (cl != null)\n\t\t\t\treturn cl;\n\t\t\tvar name = __nativeClassName(o);\n\t\t\tif (name != null)\n\t\t\t\treturn __resolveNativeClass(name);\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t@:ifFeature(\"has_enum\")\n\tprivate static function __string_rec(o,s:String) {\n\t\tuntyped {\n\t\t\tif( o == null )\n\t\t\t return \"null\";\n\t\t\tif( s.length >= 5 )\n\t\t\t\treturn \"<...>\"; // too much deep recursion\n\t\t\tvar t = __js__(\"typeof(o)\");\n\t\t\tif( t == \"function\" && (isClass(o) || isEnum(o)) )\n\t\t\t\tt = \"object\";\n\t\t\tswitch( t ) {\n\t\t\tcase \"object\":\n\t\t\t\tif( __js__(\"o instanceof Array\") ) {\n\t\t\t\t\tif( o.__enum__ ) {\n\t\t\t\t\t\tif( o.length == 2 )\n\t\t\t\t\t\t\treturn o[0];\n\t\t\t\t\t\tvar str = o[0]+\"(\";\n\t\t\t\t\t\ts += \"\\t\";\n\t\t\t\t\t\tfor( i in 2...o.length ) {\n\t\t\t\t\t\t\tif( i != 2 )\n\t\t\t\t\t\t\t\tstr += \",\" + __string_rec(o[i],s);\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tstr += __string_rec(o[i],s);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn str + \")\";\n\t\t\t\t\t}\n\t\t\t\t\tvar l = o.length;\n\t\t\t\t\tvar i;\n\t\t\t\t\tvar str = \"[\";\n\t\t\t\t\ts += \"\\t\";\n\t\t\t\t\tfor( i in 0...l )\n\t\t\t\t\t\tstr += (if (i > 0) \",\" else \"\")+__string_rec(o[i],s);\n\t\t\t\t\tstr += \"]\";\n\t\t\t\t\treturn str;\n\t\t\t\t}\n\t\t\t\tvar tostr;\n\t\t\t\ttry {\n\t\t\t\t\ttostr = untyped o.toString;\n\t\t\t\t} catch( e : Dynamic ) {\n\t\t\t\t\t// strange error on IE\n\t\t\t\t\treturn \"???\";\n\t\t\t\t}\n\t\t\t\tif( tostr != null && tostr != __js__(\"Object.toString\") && __typeof__(tostr) == \"function\" ) {\n\t\t\t\t\tvar s2 = o.toString();\n\t\t\t\t\tif( s2 != \"[object Object]\")\n\t\t\t\t\t\treturn s2;\n\t\t\t\t}\n\t\t\t\tvar k : String = null;\n\t\t\t\tvar str = \"{\\n\";\n\t\t\t\ts += \"\\t\";\n\t\t\t\tvar hasp = (o.hasOwnProperty != null);\n\t\t\t\t__js__(\"for( var k in o ) {\");\n\t\t\t\t\tif( hasp && !o.hasOwnProperty(k) )\n\t\t\t\t\t\t__js__(\"continue\");\n\t\t\t\t\tif( k == \"prototype\" || k == \"__class__\" || k == \"__super__\" || k == \"__interfaces__\" || k == \"__properties__\" )\n\t\t\t\t\t\t__js__(\"continue\");\n\t\t\t\t\tif( str.length != 2 )\n\t\t\t\t\t\tstr += \", \\n\";\n\t\t\t\t\tstr += s + k + \" : \"+__string_rec(o[k],s);\n\t\t\t\t__js__(\"}\");\n\t\t\t\ts = s.substring(1);\n\t\t\t\tstr += \"\\n\" + s + \"}\";\n\t\t\t\treturn str;\n\t\t\tcase \"function\":\n\t\t\t\treturn \"\";\n\t\t\tcase \"string\":\n\t\t\t\treturn o;\n\t\t\tdefault:\n\t\t\t\treturn String(o);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static function __interfLoop(cc : Dynamic,cl : Dynamic) {\n\t\tif( cc == null )\n\t\t\treturn false;\n\t\tif( cc == cl )\n\t\t\treturn true;\n\t\tvar intf : Dynamic = cc.__interfaces__;\n\t\tif( intf != null )\n\t\t\tfor( i in 0...intf.length ) {\n\t\t\t\tvar i : Dynamic = intf[i];\n\t\t\t\tif( i == cl || __interfLoop(i,cl) )\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\treturn __interfLoop(cc.__super__,cl);\n\t}\n\n\t@:ifFeature(\"typed_catch\") private static function __instanceof(o : Dynamic,cl : Dynamic) {\n\t\tif( cl == null )\n\t\t\treturn false;\n\t\tswitch( cl ) {\n\t\tcase Int:\n\t\t\treturn (untyped __js__(\"(o|0) === o\"));\n\t\tcase Float:\n\t\t\treturn (untyped __js__(\"typeof\"))(o) == \"number\";\n\t\tcase Bool:\n\t\t\treturn (untyped __js__(\"typeof\"))(o) == \"boolean\";\n\t\tcase String:\n\t\t\treturn (untyped __js__(\"typeof\"))(o) == \"string\";\n\t\tcase Array:\n\t\t\treturn (untyped __js__(\"(o instanceof Array)\")) && o.__enum__ == null;\n\t\tcase Dynamic:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\tif( o != null ) {\n\t\t\t\t// Check if o is an instance of a Haxe class or a native JS object\n\t\t\t\tif( (untyped __js__(\"typeof\"))(cl) == \"function\" ) {\n\t\t\t\t\tif( untyped __js__(\"o instanceof cl\") )\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tif( __interfLoop(getClass(o),cl) )\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse if ( (untyped __js__(\"typeof\"))(cl) == \"object\" && __isNativeObj(cl) ) {\n\t\t\t\t\tif( untyped __js__(\"o instanceof cl\") )\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// do not use isClass/isEnum here\n\t\t\tuntyped __feature__(\"Class.*\",if( cl == Class && o.__name__ != null ) return true);\n\t\t\tuntyped __feature__(\"Enum.*\",if( cl == Enum && o.__ename__ != null ) return true);\n\t\t\treturn o.__enum__ == cl;\n\t\t}\n\t}\n\n\t@:ifFeature(\"typed_cast\") private static function __cast(o : Dynamic, t : Dynamic) {\n\t\tif (__instanceof(o, t)) return o;\n\t\telse throw \"Cannot cast \" +Std.string(o) + \" to \" +Std.string(t);\n\t}\n\n\tstatic var __toStr = untyped __js__(\"{}.toString\");\n\t// get native JS [[Class]]\n\tstatic function __nativeClassName(o:Dynamic):String {\n\t\tvar name = untyped __toStr.call(o).slice(8, -1);\n\t\t// exclude general Object and Function\n\t\t// also exclude Math and JSON, because instanceof cannot be called on them\n\t\tif (name == \"Object\" || name == \"Function\" || name == \"Math\" || name == \"JSON\")\n\t\t\treturn null;\n\t\treturn name;\n\t}\n\n\t// check for usable native JS object\n\tstatic function __isNativeObj(o:Dynamic):Bool {\n\t\treturn __nativeClassName(o) != null;\n\t}\n\n\t// resolve native JS class in the global scope:\n\tstatic function __resolveNativeClass(name:String) {\n\t\treturn untyped js.Lib.global[name];\n\t}\n\n}\n"],
+"sourcesContent":["/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class EReg {\n\n\tvar r : HaxeRegExp;\n\n\tpublic function new( r : String, opt : String ) : Void {\n\t\topt = opt.split(\"u\").join(\"\"); // 'u' (utf8) depends on page encoding\n\t\tthis.r = new HaxeRegExp(r, opt);\n\t}\n\n\tpublic function match( s : String ) : Bool {\n\t\tif( r.global ) r.lastIndex = 0;\n\t\tr.m = r.exec(s);\n\t\tr.s = s;\n\t\treturn (r.m != null);\n\t}\n\n\tpublic function matched( n : Int ) : String {\n\t\treturn if( r.m != null && n >= 0 && n < r.m.length ) r.m[n] else throw \"EReg::matched\";\n\t}\n\n\tpublic function matchedLeft() : String {\n\t\tif( r.m == null ) throw \"No string matched\";\n\t\treturn r.s.substr(0,r.m.index);\n\t}\n\n\tpublic function matchedRight() : String {\n\t\tif( r.m == null ) throw \"No string matched\";\n\t\tvar sz = r.m.index+r.m[0].length;\n\t\treturn r.s.substr(sz,r.s.length-sz);\n\t}\n\n\tpublic function matchedPos() : { pos : Int, len : Int } {\n\t\tif( r.m == null ) throw \"No string matched\";\n\t\treturn { pos : r.m.index, len : r.m[0].length };\n\t}\n\n\tpublic function matchSub( s : String, pos : Int, len : Int = -1):Bool {\n\t\treturn if (r.global) {\n\t\t\tr.lastIndex = pos;\n\t\t\tr.m = r.exec(len < 0 ? s : s.substr(0, pos + len));\n\t\t\tvar b = r.m != null;\n\t\t\tif (b) {\n\t\t\t\tr.s = s;\n\t\t\t}\n\t\t\tb;\n\t\t} else {\n\t\t\t// TODO: check some ^/$ related corner cases\n\t\t\tvar b = match( len < 0 ? s.substr(pos) : s.substr(pos,len) );\n\t\t\tif (b) {\n\t\t\t\tr.s = s;\n\t\t\t\tr.m.index += pos;\n\t\t\t}\n\t\t\tb;\n\t\t}\n\t}\n\n\tpublic function split( s : String ) : Array {\n\t\t// we can't use directly s.split because it's ignoring the 'g' flag\n\t\tvar d = \"#__delim__#\";\n\t\treturn untyped s.replace(r,d).split(d);\n\t}\n\n\tpublic function replace( s : String, by : String ) : String {\n\t\treturn untyped s.replace(r,by);\n\t}\n\n\tpublic function map( s : String, f : EReg -> String ) : String {\n\t\tvar offset = 0;\n\t\tvar buf = new StringBuf();\n\t\tdo {\n\t\t\tif (offset >= s.length)\n\t\t\t\tbreak;\n\t\t\telse if (!matchSub(s, offset)) {\n\t\t\t\tbuf.add(s.substr(offset));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvar p = matchedPos();\n\t\t\tbuf.add(s.substr(offset, p.pos - offset));\n\t\t\tbuf.add(f(this));\n\t\t\tif (p.len == 0) {\n\t\t\t\tbuf.add(s.substr(p.pos, 1));\n\t\t\t\toffset = p.pos + 1;\n\t\t\t}\n\t\t\telse\n\t\t\t\toffset = p.pos + p.len;\n\t\t} while (r.global);\n\t\tif (!r.global && offset > 0 && offset < s.length)\n\t\t\tbuf.add(s.substr(offset));\n\t\treturn buf.toString();\n\t}\n}\n\n@:native(\"RegExp\")\nprivate extern class HaxeRegExp extends js.RegExp {\n\tvar m:js.RegExp.RegExpMatch;\n\tvar s:String;\n}\n","import js.html.Performance;\nimport js.html.DivElement;\nimport js.Browser;\n\n@:expose class Perf {\n\n\tpublic static var MEASUREMENT_INTERVAL:Int = 1000;\n\n\tpublic static var FONT_FAMILY:String = \"Helvetica,Arial\";\n\n\tpublic static var FPS_BG_CLR:String = \"#00FF00\";\n\tpublic static var FPS_WARN_BG_CLR:String = \"#FF8000\";\n\tpublic static var FPS_PROB_BG_CLR:String = \"#FF0000\";\n\n\tpublic static var MS_BG_CLR:String = \"#FFFF00\";\n\tpublic static var MEM_BG_CLR:String = \"#086A87\";\n\tpublic static var INFO_BG_CLR:String = \"#00FFFF\";\n\tpublic static var FPS_TXT_CLR:String = \"#000000\";\n\tpublic static var MS_TXT_CLR:String = \"#000000\";\n\tpublic static var MEM_TXT_CLR:String = \"#FFFFFF\";\n\tpublic static var INFO_TXT_CLR:String = \"#000000\";\n\n\tpublic static var TOP_LEFT:String = \"TL\";\n\tpublic static var TOP_RIGHT:String = \"TR\";\n\tpublic static var BOTTOM_LEFT:String = \"BL\";\n\tpublic static var BOTTOM_RIGHT:String = \"BR\";\n\n\tstatic var DELAY_TIME:Int = 4000;\n\n\tpublic var fps:DivElement;\n\tpublic var ms:DivElement;\n\tpublic var memory:DivElement;\n\tpublic var info:DivElement;\n\n\tpublic var lowFps:Float;\n\tpublic var avgFps:Float;\n\tpublic var currentFps:Float;\n\tpublic var currentMs:Float;\n\tpublic var currentMem:String;\n\n\tvar _time:Float;\n\tvar _startTime:Float;\n\tvar _prevTime:Float;\n\tvar _ticks:Int;\n\tvar _fpsMin:Float;\n\tvar _fpsMax:Float;\n\tvar _memCheck:Bool;\n\tvar _pos:String;\n\tvar _offset:Float;\n\tvar _measureCount:Int;\n\tvar _totalFps:Float;\n\n\tvar _perfObj:Performance;\n\tvar _memoryObj:Memory;\n\tvar _raf:Int;\n\n\tvar RAF:Dynamic;\n\tvar CAF:Dynamic;\n\n\tpublic function new(?pos = \"TR\", ?offset:Float = 0) {\n\t\t_perfObj = Browser.window.performance;\n\t\tif (Reflect.field(_perfObj, \"memory\") != null) _memoryObj = Reflect.field(_perfObj, \"memory\");\n\t\t_memCheck = (_perfObj != null && _memoryObj != null && _memoryObj.totalJSHeapSize > 0);\n\n\t\t_pos = pos;\n\t\t_offset = offset;\n\n\t\t_init();\n\t\t_createFpsDom();\n\t\t_createMsDom();\n\t\tif (_memCheck) _createMemoryDom();\n\n\t\tif (Browser.window.requestAnimationFrame != null) RAF = Browser.window.requestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozRequestAnimationFrame != null) RAF = untyped __js__(\"window\").mozRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitRequestAnimationFrame != null) RAF = untyped __js__(\"window\").webkitRequestAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msRequestAnimationFrame != null) RAF = untyped __js__(\"window\").msRequestAnimationFrame;\n\n\t\tif (Browser.window.cancelAnimationFrame != null) CAF = Browser.window.cancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").mozCancelAnimationFrame != null) CAF = untyped __js__(\"window\").mozCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").webkitCancelAnimationFrame != null) CAF = untyped __js__(\"window\").webkitCancelAnimationFrame;\n\t\telse if (untyped __js__(\"window\").msCancelAnimationFrame != null) CAF = untyped __js__(\"window\").msCancelAnimationFrame;\n\n\t\tif (RAF != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tinline function _init() {\n\t\tcurrentFps = 60;\n\t\tcurrentMs = 0;\n\t\tcurrentMem = \"0\";\n\n\t\tlowFps = 60;\n\t\tavgFps = 60;\n\n\t\t_measureCount = 0;\n\t\t_totalFps = 0;\n\t\t_time = 0;\n\t\t_ticks = 0;\n\t\t_fpsMin = 60;\n\t\t_fpsMax = 60;\n\t\t_startTime = _now();\n\t\t_prevTime = -MEASUREMENT_INTERVAL;\n\t}\n\n\tinline function _now():Float {\n\t\treturn (_perfObj != null && _perfObj.now != null) ? _perfObj.now() : Date.now().getTime();\n\t}\n\n\tfunction _tick(val:Float) {\n\t\tvar time = _now();\n\t\t_ticks++;\n\n\t\tif (_raf != null && time > _prevTime + MEASUREMENT_INTERVAL) {\n\t\t\tcurrentMs = Math.round(time - _startTime);\n\t\t\tms.innerHTML = \"MS: \" + currentMs;\n\n\t\t\tcurrentFps = Math.round((_ticks * 1000) / (time - _prevTime));\n\t\t\tif (currentFps > 0 && val > DELAY_TIME) {\n\t\t\t\t_measureCount++;\n\t\t\t\t_totalFps += currentFps;\n\t\t\t\tlowFps = _fpsMin = Math.min(_fpsMin, currentFps);\n\t\t\t\t_fpsMax = Math.max(_fpsMax, currentFps);\n\t\t\t\tavgFps = Math.round(_totalFps / _measureCount);\n\t\t\t}\n\n\t\t\tfps.innerHTML = \"FPS: \" + currentFps + \" (\" + _fpsMin + \"-\" + _fpsMax + \")\";\n\n\t\t\tif (currentFps >= 30) fps.style.backgroundColor = FPS_BG_CLR;\n\t\t\telse if (currentFps >= 15) fps.style.backgroundColor = FPS_WARN_BG_CLR;\n\t\t\telse fps.style.backgroundColor = FPS_PROB_BG_CLR;\n\n\t\t\t_prevTime = time;\n\t\t\t_ticks = 0;\n\n\t\t\tif (_memCheck) {\n\t\t\t\tcurrentMem = _getFormattedSize(_memoryObj.usedJSHeapSize, 2);\n\t\t\t\tmemory.innerHTML = \"MEM: \" + currentMem;\n\t\t\t}\n\t\t}\n\t\t_startTime = time;\n\n\t\tif (_raf != null) _raf = Reflect.callMethod(Browser.window, RAF, [_tick]);\n\t}\n\n\tfunction _createDiv(id:String, ?top:Float = 0):DivElement {\n\t\tvar div:DivElement = Browser.document.createDivElement();\n\t\tdiv.id = id;\n\t\tdiv.className = id;\n\t\tdiv.style.position = \"absolute\";\n\n\t\tswitch (_pos) {\n\t\t\tcase \"TL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"TR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.top = top + \"px\";\n\t\t\tcase \"BL\":\n\t\t\t\tdiv.style.left = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t\tcase \"BR\":\n\t\t\t\tdiv.style.right = _offset + \"px\";\n\t\t\t\tdiv.style.bottom = ((_memCheck) ? 48 : 32) - top + \"px\";\n\t\t}\n\n\t\tdiv.style.width = \"80px\";\n\t\tdiv.style.height = \"12px\";\n\t\tdiv.style.lineHeight = \"12px\";\n\t\tdiv.style.padding = \"2px\";\n\t\tdiv.style.fontFamily = FONT_FAMILY;\n\t\tdiv.style.fontSize = \"9px\";\n\t\tdiv.style.fontWeight = \"bold\";\n\t\tdiv.style.textAlign = \"center\";\n\t\tBrowser.document.body.appendChild(div);\n\t\treturn div;\n\t}\n\n\tfunction _createFpsDom() {\n\t\tfps = _createDiv(\"fps\");\n\t\tfps.style.backgroundColor = FPS_BG_CLR;\n\t\tfps.style.zIndex = \"995\";\n\t\tfps.style.color = FPS_TXT_CLR;\n\t\tfps.innerHTML = \"FPS: 0\";\n\t}\n\n\tfunction _createMsDom() {\n\t\tms = _createDiv(\"ms\", 16);\n\t\tms.style.backgroundColor = MS_BG_CLR;\n\t\tms.style.zIndex = \"996\";\n\t\tms.style.color = MS_TXT_CLR;\n\t\tms.innerHTML = \"MS: 0\";\n\t}\n\n\tfunction _createMemoryDom() {\n\t\tmemory = _createDiv(\"memory\", 32);\n\t\tmemory.style.backgroundColor = MEM_BG_CLR;\n\t\tmemory.style.color = MEM_TXT_CLR;\n\t\tmemory.style.zIndex = \"997\";\n\t\tmemory.innerHTML = \"MEM: 0\";\n\t}\n\n\tfunction _getFormattedSize(bytes:Float, ?frac:Int = 0):String {\n\t\tvar sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n\t\tif (bytes == 0) return \"0\";\n\t\tvar precision = Math.pow(10, frac);\n\t\tvar i = Math.floor(Math.log(bytes) / Math.log(1024));\n\t\treturn Math.round(bytes * precision / Math.pow(1024, i)) / precision + \" \" + sizes[i];\n\t}\n\n\tpublic function addInfo(val:String) {\n\t\tinfo = _createDiv(\"info\", (_memCheck) ? 48 : 32);\n\t\tinfo.style.backgroundColor = INFO_BG_CLR;\n\t\tinfo.style.color = INFO_TXT_CLR;\n\t\tinfo.style.zIndex = \"998\";\n\t\tinfo.innerHTML = val;\n\t}\n\n\tpublic function clearInfo() {\n\t\tif (info != null) {\n\t\t\tBrowser.document.body.removeChild(info);\n\t\t\tinfo = null;\n\t\t}\n\t}\n\n\tpublic function destroy() {\n\t\t_cancelRAF();\n\t\t_perfObj = null;\n\t\t_memoryObj = null;\n\t\tif (fps != null) {\n\t\t\tBrowser.document.body.removeChild(fps);\n\t\t\tfps = null;\n\t\t}\n\t\tif (ms != null) {\n\t\t\tBrowser.document.body.removeChild(ms);\n\t\t\tms = null;\n\t\t}\n\t\tif (memory != null) {\n\t\t\tBrowser.document.body.removeChild(memory);\n\t\t\tmemory = null;\n\t\t}\n\t\tclearInfo();\n\t\t_init();\n\t}\n\n\tinline function _cancelRAF() {\n\t\tReflect.callMethod(Browser.window, CAF, [_raf]);\n\t\t_raf = null;\n\t}\n}\n\ntypedef Memory = {\n\tvar usedJSHeapSize:Float;\n\tvar totalJSHeapSize:Float;\n\tvar jsHeapSizeLimit:Float;\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class Reflect {\n\n\tpublic inline static function hasField( o : Dynamic, field : String ) : Bool {\n\t\treturn untyped __js__('Object').prototype.hasOwnProperty.call(o, field);\n\t}\n\n\tpublic static function field( o : Dynamic, field : String ) : Dynamic {\n\t\ttry return untyped o[field] catch( e : Dynamic ) return null;\n\t}\n\n\tpublic inline static function setField( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\to[field] = value;\n\t}\n\n\tpublic static inline function getProperty( o : Dynamic, field : String ) : Dynamic untyped {\n\t\tvar tmp;\n\t\treturn if( o == null ) __define_feature__(\"Reflect.getProperty\",null) else if( o.__properties__ && (tmp=o.__properties__[\"get_\"+field]) ) o[tmp]() else o[field];\n\t}\n\n\tpublic static inline function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\tvar tmp;\n\t\tif( o.__properties__ && (tmp=o.__properties__[\"set_\"+field]) ) o[tmp](value) else o[field] = __define_feature__(\"Reflect.setProperty\",value);\n\t}\n\n\tpublic inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array ) : Dynamic untyped {\n\t\treturn func.apply(o,args);\n\t}\n\n\tpublic static function fields( o : Dynamic ) : Array {\n\t\tvar a = [];\n\t\tif (o != null) untyped {\n\t\t\tvar hasOwnProperty = __js__('Object').prototype.hasOwnProperty;\n\t\t\t__js__(\"for( var f in o ) {\");\n\t\t\tif( f != \"__id__\" && f != \"hx__closures__\" && hasOwnProperty.call(o, f) ) a.push(f);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static function isFunction( f : Dynamic ) : Bool untyped {\n\t\treturn __js__(\"typeof(f)\") == \"function\" && !(js.Boot.isClass(f) || js.Boot.isEnum(f));\n\t}\n\n\tpublic static function compare( a : T, b : T ) : Int {\n\t\treturn ( a == b ) ? 0 : (((cast a) > (cast b)) ? 1 : -1);\n\t}\n\n\tpublic static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool {\n\t\tif( f1 == f2 )\n\t\t\treturn true;\n\t\tif( !isFunction(f1) || !isFunction(f2) )\n\t\t\treturn false;\n\t\treturn f1.scope == f2.scope && f1.method == f2.method && f1.method != null;\n\t}\n\n\tpublic static function isObject( v : Dynamic ) : Bool untyped {\n\t\tif( v == null )\n\t\t\treturn false;\n\t\tvar t = __js__(\"typeof(v)\");\n\t\treturn (t == \"string\" || (t == \"object\" && v.__enum__ == null)) || (t == \"function\" && (js.Boot.isClass(v) || js.Boot.isEnum(v)) != null);\n\t}\n\n\tpublic static function isEnumValue( v : Dynamic ) : Bool {\n\t\treturn v != null && v.__enum__ != null;\n\t}\n\n\tpublic static function deleteField( o : Dynamic, field : String ) : Bool untyped {\n\t\tif( !hasField(o,field) ) return false;\n\t\t__js__(\"delete\")(o[field]);\n\t\treturn true;\n\t}\n\n\tpublic static function copy( o : T ) : T {\n\t\tvar o2 : Dynamic = {};\n\t\tfor( f in Reflect.fields(o) )\n\t\t\tReflect.setField(o2,f,Reflect.field(o,f));\n\t\treturn o2;\n\t}\n\n\t@:overload(function( f : Array -> Void ) : Dynamic {})\n\tpublic static function makeVarArgs( f : Array -> Dynamic ) : Dynamic {\n\t\treturn function() {\n\t\t\tvar a = untyped Array.prototype.slice.call(__js__(\"arguments\"));\n\t\t\treturn f(a);\n\t\t};\n\t}\n\n}\n","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport js.Boot;\n\n@:keepInit\n@:coreApi class Std {\n\n\tpublic static inline function is( v : Dynamic, t : Dynamic ) : Bool {\n\t\treturn untyped js.Boot.__instanceof(v,t);\n\t}\n\n\tpublic static inline function instance( value : T, c : Class ) : S {\n\t\treturn untyped __instanceof__(value, c) ? cast value : null;\n\t}\n\n\tpublic static function string( s : Dynamic ) : String {\n\t\treturn untyped js.Boot.__string_rec(s,\"\");\n\t}\n\n\tpublic static inline function int( x : Float ) : Int {\n\t\treturn (cast x) | 0;\n\t}\n\n\tpublic static function parseInt( x : String ) : Null {\n\t\tvar v = untyped __js__(\"parseInt\")(x, 10);\n\t\t// parse again if hexadecimal\n\t\tif( v == 0 && (x.charCodeAt(1) == 'x'.code || x.charCodeAt(1) == 'X'.code) )\n\t\t\tv = untyped __js__(\"parseInt\")(x);\n\t\tif( untyped __js__(\"isNaN\")(v) )\n\t\t\treturn null;\n\t\treturn cast v;\n\t}\n\n\tpublic static inline function parseFloat( x : String ) : Float {\n\t\treturn untyped __js__(\"parseFloat\")(x);\n\t}\n\n\tpublic static function random( x : Int ) : Int {\n\t\treturn untyped x <= 0 ? 0 : Math.floor(Math.random()*x);\n\t}\n\n\tstatic function __init__() : Void untyped {\n\t\t__feature__(\"js.Boot.getClass\",String.prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"String\"] = String,String));\n\t\t__feature__(\"js.Boot.isClass\",String.__name__ = __feature__(\"Type.getClassName\",[\"String\"],true));\n\t\t__feature__(\"Type.resolveClass\",$hxClasses[\"Array\"] = Array);\n\t\t__feature__(\"js.Boot.isClass\",Array.__name__ = __feature__(\"Type.getClassName\",[\"Array\"],true));\n\t\t__feature__(\"Date.*\", {\n\t\t\t__feature__(\"js.Boot.getClass\",__js__('Date').prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"Date\"] = __js__('Date'),__js__('Date')));\n\t\t\t__feature__(\"js.Boot.isClass\",__js__('Date').__name__ = [\"Date\"]);\n\t\t});\n\t\t__feature__(\"Int.*\",{\n\t\t\tvar Int = __feature__(\"Type.resolveClass\", $hxClasses[\"Int\"] = { __name__ : [\"Int\"] }, { __name__ : [\"Int\"] });\n\t\t});\n\t\t__feature__(\"Dynamic.*\",{\n\t\t\tvar Dynamic = __feature__(\"Type.resolveClass\", $hxClasses[\"Dynamic\"] = { __name__ : [\"Dynamic\"] }, { __name__ : [\"Dynamic\"] });\n\t\t});\n\t\t__feature__(\"Float.*\",{\n\t\t\tvar Float = __feature__(\"Type.resolveClass\", $hxClasses[\"Float\"] = __js__(\"Number\"), __js__(\"Number\"));\n\t\t\tFloat.__name__ = [\"Float\"];\n\t\t});\n\t\t__feature__(\"Bool.*\",{\n\t\t\tvar Bool = __feature__(\"Type.resolveEnum\",$hxClasses[\"Bool\"] = __js__(\"Boolean\"), __js__(\"Boolean\"));\n\t\t\tBool.__ename__ = [\"Bool\"];\n\t\t});\n\t\t__feature__(\"Class.*\",{\n\t\t\tvar Class = __feature__(\"Type.resolveClass\", $hxClasses[\"Class\"] = { __name__ : [\"Class\"] }, { __name__ : [\"Class\"] });\n\t\t});\n\t\t__feature__(\"Enum.*\",{\n\t\t\tvar Enum = {};\n\t\t});\n\t\t__feature__(\"Void.*\",{\n\t\t\tvar Void = __feature__(\"Type.resolveEnum\", $hxClasses[\"Void\"] = { __ename__ : [\"Void\"] }, { __ename__ : [\"Void\"] });\n\t\t});\n\n#if !js_es5\n\t\t__feature__(\"Array.map\",\n\t\t\tif( Array.prototype.map == null )\n\t\t\t\tArray.prototype.map = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length )\n\t\t\t\t\t\ta[i] = f(__this__[i]);\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n\t\t__feature__(\"Array.filter\",\n\t\t\tif( Array.prototype.filter == null )\n\t\t\t\tArray.prototype.filter = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length ) {\n\t\t\t\t\t\tvar e = __this__[i];\n\t\t\t\t\t\tif( f(e) ) a.push(e);\n\t\t\t\t\t}\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n#end\n\t}\n\n}\n","package pixi.plugins.app;\n\nimport pixi.core.renderers.SystemRenderer;\nimport js.html.Event;\nimport pixi.core.RenderOptions;\nimport pixi.core.display.Container;\nimport js.html.Element;\nimport js.html.CanvasElement;\nimport js.Browser;\n\n/**\n * Pixi Boilerplate Helper class that can be used by any application\n * @author Adi Reddy Mora\n * http://adireddy.github.io\n * @license MIT\n * @copyright 2015\n */\nclass Application {\n\n\t/**\n * Sets the pixel ratio of the application.\n * default - 1\n */\n\tpublic var pixelRatio:Float;\n\n\t/**\n\t * Width of the application.\n\t * default - Browser.window.innerWidth\n\t */\n\tpublic var width:Float;\n\n\t/**\n\t * Height of the application.\n\t * default - Browser.window.innerHeight\n\t */\n\tpublic var height:Float;\n\n\t/**\n\t * Position of canvas element\n\t * default - static\n\t */\n\tpublic var position:String;\n\n\t/**\n\t * Renderer transparency property.\n\t * default - false\n\t */\n\tpublic var transparent:Bool;\n\n\t/**\n\t * Graphics antialias property.\n\t * default - false\n\t */\n\tpublic var antialias:Bool;\n\n\t/**\n\t * Force FXAA shader antialias instead of native (faster).\n\t * default - false\n\t */\n\tpublic var forceFXAA:Bool;\n\n\t/**\n\t * Force round pixels.\n\t * default - false\n\t */\n\tpublic var roundPixels:Bool;\n\n\t/**\n\t * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.\n * If the scene is transparent Pixi will use clearRect to clear the canvas every frame.\n * Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.\n\t * default - true\n\t */\n\tpublic var clearBeforeRender:Bool;\n\n\t/**\n\t * enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context\n\t * default - false\n\t */\n\tpublic var preserveDrawingBuffer:Bool;\n\n\t/**\n\t * Whether you want to resize the canvas and renderer on browser resize.\n\t * Should be set to false when custom width and height are used for the application.\n\t * default - true\n\t */\n\tpublic var autoResize:Bool;\n\n\t/**\n\t * Sets the background color of the stage.\n\t * default - 0xFFFFFF\n\t */\n\tpublic var backgroundColor:Int;\n\n\t/**\n\t * Update listener \tfunction\n\t */\n\tpublic var onUpdate:Float -> Void;\n\n\t/**\n\t * Window resize listener \tfunction\n\t */\n\tpublic var onResize:Void -> Void;\n\n\t/**\n\t * Canvas Element\n\t * Read-only\n\t */\n\tpublic var canvas(default, null):CanvasElement;\n\n\t/**\n\t * Renderer\n\t * Read-only\n\t */\n\tpublic var renderer(default, null):SystemRenderer;\n\n\t/**\n\t * Global Container.\n\t * Read-only\n\t */\n\tpublic var stage(default, null):Container;\n\n\t/**\n\t * Pixi Application\n\t * Read-only\n\t */\n\tpublic var app(default, null):pixi.core.Application;\n\n\tpublic static inline var AUTO:String = \"auto\";\n\tpublic static inline var RECOMMENDED:String = \"recommended\";\n\tpublic static inline var CANVAS:String = \"canvas\";\n\tpublic static inline var WEBGL:String = \"webgl\";\n\n\tpublic static inline var POSITION_STATIC:String = \"static\";\n\tpublic static inline var POSITION_ABSOLUTE:String = \"absolute\";\n\tpublic static inline var POSITION_FIXED:String = \"fixed\";\n\tpublic static inline var POSITION_RELATIVE:String = \"relative\";\n\tpublic static inline var POSITION_INITIAL:String = \"initial\";\n\tpublic static inline var POSITION_INHERIT:String = \"inherit\";\n\n\tvar _frameCount:Int;\n\tvar _animationFrameId:Null;\n\n\tpublic function new() {\n\t\t_setDefaultValues();\n\t}\n\n\tinline function _setDefaultValues() {\n\t\t_animationFrameId = null;\n\t\tpixelRatio = 1;\n\t\tautoResize = true;\n\t\ttransparent = false;\n\t\tantialias = false;\n\t\tforceFXAA = false;\n\t\troundPixels = false;\n\t\tclearBeforeRender = true;\n\t\tpreserveDrawingBuffer = false;\n\t\tbackgroundColor = 0xFFFFFF;\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tposition = \"static\";\n\t}\n\n\t/**\n\t * Starts pixi application setup using the properties set or default values\n\t * @param [rendererType] - Renderer type to use AUTO (default) | CANVAS | WEBGL\n\t * @param [stats] - Enable/disable stats for the application.\n\t * Note that stats.js is not part of pixi so don't forget to include it you html page\n\t * Can be found in libs folder. \"libs/stats.min.js\" \n\t * @param [parentDom] - By default canvas will be appended to body or it can be appended to custom element if passed\n\t */\n\n\tpublic function start(?rendererType:String = \"auto\", ?parentDom:Element, ?canvasElement:CanvasElement) {\n\t\tif (canvasElement == null) {\n\t\t\tcanvas = Browser.document.createCanvasElement();\n\t\t\tcanvas.style.width = width + \"px\";\n\t\t\tcanvas.style.height = height + \"px\";\n\t\t\tcanvas.style.position = position;\n\t\t}\n\t\telse canvas = canvasElement;\n\n\t\tif (autoResize) Browser.window.onresize = _onWindowResize;\n\n\t\tvar renderingOptions:RenderOptions = {};\n\t\trenderingOptions.view = canvas;\n\t\trenderingOptions.backgroundColor = backgroundColor;\n\t\trenderingOptions.resolution = pixelRatio;\n\t\trenderingOptions.antialias = antialias;\n\t\trenderingOptions.forceFXAA = forceFXAA;\n\t\trenderingOptions.autoResize = autoResize;\n\t\trenderingOptions.transparent = transparent;\n\t\trenderingOptions.clearBeforeRender = clearBeforeRender;\n\t\trenderingOptions.preserveDrawingBuffer = preserveDrawingBuffer;\n\t\trenderingOptions.roundPixels = roundPixels;\n\n\t\tswitch (rendererType) {\n\t\t\tcase CANVAS: app = new pixi.core.Application(width, height, renderingOptions, true);\n\t\t\tdefault: app = new pixi.core.Application(width, height, renderingOptions);\n\t\t}\n\n\t\tstage = app.stage;\n\t\trenderer = app.renderer;\n\n\t\tif (parentDom == null) Browser.document.body.appendChild(app.view);\n\t\telse parentDom.appendChild(app.view);\n\n\t\tapp.ticker.add(_onRequestAnimationFrame);\n\n\t\t#if stats addStats(); #end\n\t}\n\n\tpublic function pauseRendering() {\n\t\tapp.stop();\n\t}\n\n\tpublic function resumeRendering() {\n\t\tapp.start();\n\t}\n\n\t@:noCompletion function _onWindowResize(event:Event) {\n\t\twidth = Browser.window.innerWidth;\n\t\theight = Browser.window.innerHeight;\n\t\tapp.renderer.resize(width, height);\n\t\tcanvas.style.width = width + \"px\";\n\t\tcanvas.style.height = height + \"px\";\n\n\t\tif (onResize != null) onResize();\n\t}\n\n\t@:noCompletion function _onRequestAnimationFrame() {\n\t\tif (onUpdate != null) onUpdate(app.ticker.deltaTime);\n\t}\n\n\tpublic function addStats() {\n\t\tif (untyped __js__(\"window\").Perf != null) {\n\t\t\tnew Perf().addInfo([\"UNKNOWN\", \"WEBGL\", \"CANVAS\"][app.renderer.type] + \" - \" + pixelRatio);\n\t\t}\n\t}\n}","package devicedetection;\n\nimport pixi.core.display.Container;\nimport pixi.core.text.Text;\nimport pixi.plugins.app.Application;\nimport js.Browser;\n\nclass Main extends Application {\n\n\tvar _info:Container;\n\n\tpublic function new() {\n\t\tsuper();\n\t\t_init();\n\t}\n\n\tfunction _init() {\n\t\tbackgroundColor = 0x003366;\n\t\tsuper.start();\n\n\t\t_info = new Container();\n\t\tstage.addChild(_info);\n\n\t\tvar txt = new Text(\"\", {fill: \"#FFFFFF\"});\n\t\ttxt.text = \"Android:\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" + _isAndroid();\n\t\t_info.addChild(txt);\n\n\t\ttxt = new Text(\"\", {fill: \"#FFFFFF\"});\n\t\ttxt.text = \"Android Phone:\\t\\t\\t\\t\\t\" + _isAndroidPhone();\n\t\ttxt.y = 40;\n\t\t_info.addChild(txt);\n\n\t\ttxt = new Text(\"\", {fill: \"#FFFFFF\"});\n\t\ttxt.text = \"iOS:\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" + _isiOS();\n\t\ttxt.y = 80;\n\t\t_info.addChild(txt);\n\n\t\ttxt = new Text(\"\", {fill: \"#FFFFFF\"});\n\t\ttxt.text = \"iOS Phone:\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" + _isiOSPhone();\n\t\ttxt.y = 120;\n\t\t_info.addChild(txt);\n\n\t\ttxt = new Text(\"\", {fill: \"#FFFFFF\"});\n\t\ttxt.text = \"Windows:\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" + _isWindows();\n\t\ttxt.y = 160;\n\t\t_info.addChild(txt);\n\n\t\ttxt = new Text(\"\", {fill: \"#FFFFFF\"});\n\t\ttxt.text = \"Windows Phone:\\t\\t\\t\" + _isWindowsPhone();\n\t\ttxt.y = 200;\n\t\t_info.addChild(txt);\n\n\t\t_info.position.x = (Browser.window.innerWidth - _info.width) / 2;\n\t\t_info.position.y = (Browser.window.innerHeight - _info.height) / 2;\n\t}\n\n\tfunction _isAndroid():Bool {\n\t\treturn ~/Android/i.match(Browser.navigator.userAgent);\n\t}\n\n\tfunction _isAndroidPhone():Bool {\n\t\treturn ~/Android/i.match(Browser.navigator.userAgent) && ~/Mobile/i.match(Browser.navigator.userAgent);\n\t}\n\n\tfunction _isiOS():Bool {\n\t\treturn ~/(iPad|iPhone|iPod)/i.match(Browser.navigator.userAgent);\n\t}\n\n\tfunction _isiOSPhone():Bool {\n\t\treturn ~/(iPhone|iPod)/i.match(Browser.navigator.userAgent);\n\t}\n\n\tfunction _isWindows():Bool {\n\t\treturn ~/(Windows|iemobile)/i.match(Browser.navigator.userAgent);\n\t}\n\n\tfunction _isWindowsPhone():Bool {\n\t\treturn ~/Windows Phone/i.match(Browser.navigator.userAgent) || ~/iemobile/i.match(Browser.navigator.userAgent);\n\t}\n\n\tfunction _getiOSVersion():Array {\n\t\tvar v:EReg = ~/[0-9_]+?[0-9_]+?[0-9_]+/i;\n\t\tvar matched:Array = [];\n\t\tif (v.match(Browser.navigator.userAgent)) {\n\t\t\tvar match:Array = v.matched(0).split(\"_\");\n\t\t\tmatched = [for (i in match) Std.parseInt(i)];\n\t\t}\n\t\treturn matched;\n\t}\n\n\tstatic function main() {\n\t\tnew Main();\n\t}\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\npackage js;\n\nprivate class HaxeError extends js.Error {\n\n\tvar val:Dynamic;\n\n\tpublic function new(val:Dynamic) untyped {\n\t\tsuper();\n\t\tthis.val = __define_feature__(\"js.Boot.HaxeError\", val);\n\t\tthis.message = String(val);\n\t\tif (js.Error.captureStackTrace) js.Error.captureStackTrace(this, HaxeError);\n\t}\n}\n\n@:dox(hide)\nclass Boot {\n\n\tprivate static function __unhtml(s : String) {\n\t\treturn s.split(\"&\").join(\"&\").split(\"<\").join(\"<\").split(\">\").join(\">\");\n\t}\n\n\tprivate static function __trace(v,i : haxe.PosInfos) {\n\t\tuntyped {\n\t\t\tvar msg = if( i != null ) i.fileName+\":\"+i.lineNumber+\": \" else \"\";\n\t\t\t#if jsfl\n\t\t\tmsg += __string_rec(v,\"\");\n\t\t\tfl.trace(msg);\n\t\t\t#else\n\t\t\tmsg += __string_rec(v, \"\");\n\t\t\tif( i != null && i.customParams != null )\n\t\t\t\tfor( v in i.customParams )\n\t\t\t\t\tmsg += \",\" + __string_rec(v, \"\");\n\t\t\tvar d;\n\t\t\tif( __js__(\"typeof\")(document) != \"undefined\" && (d = document.getElementById(\"haxe:trace\")) != null )\n\t\t\t\td.innerHTML += __unhtml(msg)+\"