Kiwi.Utils.Common Class
Methods to assist in working with Structs. A lot of the functions in this class are Copyright 2012 Mauricio Santos and used with permission. His work is licensed under the Apache License, Version 2.0 (the "License")
Item Index
Methods
- compareToEquals static
- convertToBase2 static
- defaultCompare static
- defaultEquals static
- defaultToString static
- isArray static
- isBetween static
- isFunction static
- isNumeric static
- isObject static
- isString static
- isUndefined static
- objType
- reverseCompareFunction static
- shuffleArray static
Properties
- base2Sizes static
Methods
compareToEquals
-
compareFunction
Returns an equal function given a compare function.
Parameters:
-
compareFunction
Any
Returns:
convertToBase2
-
imageFile
A method that checks to see if an Image or Canvas that is passed has base2 proportions. If it doesn't the image is created on a Canvas and that Canvas is returned. Used mainly when creating TextureAtlases for WebGL.
Parameters:
-
imageFile
HTMLImageElement/HTMLCanvasElementThe image or canvas element that is to be converted into a base2size.
Returns:
The image that was passed (if it was already at base2 dimensions) or a new canvas element if it wasn't.
defaultCompare
-
a.
-
b.
Default function to compare element order.
Parameters:
-
a.
Any -
b.
Any
Returns:
defaultEquals
-
a
-
b
Default function to test equality.
Parameters:
-
a
Any -
b
Any
Returns:
defaultToString
-
item
Default function to convert an object to a string.
Parameters:
-
item
Any
Returns:
isArray
-
obj
Checks if the given argument is a array.
Parameters:
-
obj
Any
Returns:
isBetween
-
x
-
min
-
max
Returns a boolean indicating whether x is between two parameters passed.
Parameters:
-
x
NumberThe values to be checked
-
min
NumberThe minimum value
-
max
NumberThe maximum value
Returns:
isFunction
-
func.
Checks if the given argument is a function.
Parameters:
-
func.
Any
Returns:
isNumeric
-
value
Checks if the given value is numeric.
Parameters:
-
value
Any
Returns:
isObject
-
obj
Checks if the given argument is an object.
Parameters:
-
obj
Any
Returns:
isString
-
obj
Checks if the given argument is a string.
Parameters:
-
obj
Any
Returns:
isUndefined
-
obj
Checks if the given argument is undefined.
Parameters:
-
obj
Any
Returns:
objType
()
String
public
The type of object that this is.
Returns:
"Common"
reverseCompareFunction
-
compareFunction
Reverses a compare function.
Parameters:
-
compareFunction
Any
Returns:
shuffleArray
-
array
Shuffles the contents of an array given into a random order.
Parameters:
-
array
Any
Returns:
What you passed but the with the contents in a new order.
Properties
base2Sizes
Number
public
static
An array containing all of the base2sizes that are allowed. This is used when creating a new TextureAtlas/or resizing a Image to be rendered in WebGL.