class flixel.addons.ui.U
Available on all platforms
Utility functions, inlined where possible * @author Lars Doucet
Class Fields
static function bitStringDimensions(str:String):Point
Get the dimensions of a bit string * @return
str | * |
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 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 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 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 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 splitBitString(str:String):Array<Int>
Splits a binary string with endlines into a big long int array * @return
str | * |
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_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 "" |