class flixel.addons.ui.U

Available on all platforms

Utility functions, inlined where possible * @author Lars Doucet

Class Fields

static function FU(str:String):String

static function FU_(str:String):String

static function aabb_test(a:FlxObject, b:FlxObject):Bool

static function aabb_test_mult(a:FlxObject, b:FlxObject, ?multA:Float = 1, ?multB:Float = 1):Bool

static function bitStringDimensions(str:String):Point

Get the dimensions of a bit string * @return

str*

static function blendModeFromString(str:String):BlendMode

static function bmpToCSVLayer(color_index:Int, bd:BitmapData):String

Converts a PNG file to a comma-separated string. pixels that match color_index are flagged others are ignored must be a PERFECT MATCH *

color_index

The matching color index

returns

A comma-separated string containing the level data in a FlxTilemap-friendly format.

static function center(fb1:FlxObject, fb2:FlxObject, ?centerX:Bool = true, ?centerY:Bool = true):Void

Center fb2 on fb1's center point *

fb1

a FlxObject (does not move) *

fb2

a FlxObject (center on fb1) *

centerX

center X axis? *

centerY

center Y axis?

static function checkHaxedef(str:String):Bool

static function circle_test(x1:Float, y1:Float, r1:Float, x2:Float, y2:Float, r2:Float):Bool

static function clearArray(array:Array<Dynamic>):Void

This will MURDER an array, removing all traces of both it and its contents *

array

static function clearArraySoft(array:Array<Dynamic>):Void

This will remove an array structure, but will leave its contents untouched. * This can lead to memory leaks! Only use this when you want an array gone but * you still need the original elements and know what you're doing. *

array

static function copyFast(fast:Fast):Fast

static function copyXml(data:Xml):Xml

static function copy_shallow_arr(src:Array<Dynamic>):Array<Dynamic>

static function copy_shallow_arr_i(src:Array<Int>):Array<Int>

static function destroyThing(thing:Dynamic):Void

static function dirStr(XX:Int, YY:Int):String

static function disposeXML(thing:Dynamic):Void

static function field(object:Dynamic, field:String, ?_default:Dynamic = null):Dynamic

static function font(str:String, ?style:String = ''):String

static function fontStr(str:String, ?style:String = ''):String

static function formatXml(_xml:Xml):String

static function fs(data:Dynamic):FlxSprite

static function fsx(data:Dynamic):FlxUISprite

static function getLocList(xmin:Int, ymin:Int, xmax:Int, ymax:Int):Array<FlxPoint>

static function getXML(str:String, ?folder:String = ''):Dynamic

static function get_gfx(str:String):String

static function gfx(id:String, ?dir1:String = '', ?dir2:String = '', ?dir3:String = '', ?dir4:String = '', ?suppressError:Bool = false):String

static function hex2rgb(hex:Int):Array<Int>

Parses hex pixel value into a 3-length array of [r,g,b] ints * @return

hex*

static function hexChar2dec(hex_char:String):Int

Parses an individual hexadecimal string character to the equivalent decimal integer value *

hex_char

hexadecimal character (1-length string) *

returns

decimal value of hex_char

static function intStr_to_arr(str:String):Array<Int>

Converts a comma and hyphen list string of numbers to an int array *

str

input, ex: "1,2,3", "2-4", "1,2,3,5-10" *

returns

int array, ex: [1,2,3], [2,3,4], [1,2,3,5,6,7,8,9,10]

static function intStr_to_arrStr(str:String):Array<String>

Converts a comma and hyphen list string of numbers to a String array *

str

input, ex: "1,2,3", "2-4", "1,2,3,5-10" *

returns

int array, ex: [1,2,3], [2,3,4], [1,2,3,5,6,7,8,9,10]

static function interpolate(hex1:Int, hex2:Int, amt:Float):Int

Returns a color somewhere between the given two. * @return

hex1

A hexadecimal color *

hex2

A hexadecimal color *

amt

0=100% hex1, 1=100% hex2, 0.5=50% of each *

static function isStrFloat(str:String):Bool

static function isStrInt(str:String):Bool

static function isStrNum(str:String):Bool

static function json(str:String, ?extension:String = 'json', ?dir:String = 'assets/json/'):Dynamic

static function padDigits(i:Int, d:Int):String

Return a numeric string with leading zeroes *

i

any integer *

d

how many digits *

returns

i's value as a string padded with zeroes, exactly d digits in length

static function parseHex(str:String, ?cast32Bit:Bool = false, ?safe:Bool = false, ?default_color:Int = 0):Int

Parses hex string to equivalent integer, with safety checks *

hex_str

string in format 0xRRGGBB or 0xAARRGGBB *

cast32Bit

add an alpha channel if none is given *

safe

don't throw errors, just return -1 *

default_color

what to return if safe is true and it fails *

returns

integer value

static function perc_to_float(str:String):Float

If a string is a number that ends with a % sign, it will return a normalized percent float (0-100% = 0.0-1.0) *

str

a percentage value, such as "5%" or "236.214%" *

returns

a normalized float, or NaN if not valid input

static function point_circle_test(x:Float, y:Float, cx:Float, cy:Float, r:Float):Bool

static function rgb2hex(r:Int, g:Int, b:Int):Int

Returns the hex pixel value of 3 r, g, b ints * @return

r*
g*
b*

static function sfx(str:String):String

static function splitBitString(str:String):Array<Int>

Splits a binary string with endlines into a big long int array * @return

str*

static function strCase(str:String, code:String):String

static function test_float(f1:Float, test:String, f2:Int):Bool

static function test_int(i1:Int, test:String, i2:Int):Bool

static function xml(id:String, ?extension:String = 'xml', ?getFast:Bool = true, ?dir:String = 'assets/xml/'):Dynamic

static function xml_bool(data:Xml, att:String, ?default_:Bool = false):Bool

Safety wrapper for reading a bool attribute from xml *

data

the Xml object *

att

the name of the attribute *

what

to return if the value doesn't exist *

returns

true if att is "true" (case-insensitive) or "1", otherwise false

static function xml_f(data:Xml, att:String, ?default_:Float = 0):Float

Safety wrapper for reading a float attribute from xml *

data

the Xml object *

att

the name of the attribute *

default_

what to return if the value doesn't exist *

returns

the attribute as a float if it exists, otherwise returns 0

static function xml_gfx(data:Xml, att:String, ?test:Bool = true):String

static function xml_i(data:Xml, att:String, ?default_:Int = 0):Int

Safety wrapper for reading an int attribute from xml *

data

the Xml object *

att

the name of the attribute *

default_

what to return if the value doesn't exist *

returns

the attribute as an int if it exists, otherwise returns 0

static function xml_str(data:Xml, att:String, ?lower_case:Bool = false, ?default_str:String = ''):String

Safety wrapper for reading a string attribute from xml *

data

the Xml object *

att

the name of the attribute *

lower_case

force lower_case or not *

what

to return if it is "" *

returns

the attribute as a string if it exists, otherwise returns ""