Class: Utils

Phaser. Utils

new Utils()

Source:

Classes

Debug

Methods

<static> extend(deep, target) → {object}

This is a slightly modified version of http://api.jquery.com/jQuery.extend/

Parameters:
Name Type Description
deep boolean

Perform a deep copy?

target object

The target object to copy to.

Source:
Returns:

The extended object.

Type
object

<static> getProperty(obj, prop) → {*}

Gets an objects property by string.

Parameters:
Name Type Description
obj object

The object to traverse.

prop string

The property whose value will be returned.

Source:
Returns:

the value of the property or null if property isn't found .

Type
*

<static> isPlainObject(obj) → {boolean}

This is a slightly modified version of jQuery.isPlainObject. A plain object is an object whose internal class property is [object Object].

Parameters:
Name Type Description
obj object

The object to inspect.

Source:
Returns:
  • true if the object is plain, otherwise false.
Type
boolean

<static> mixin(from, to) → {object}

Mixes the source object into the destination object, returning the newly modified destination object. Based on original code by @mudcube

Parameters:
Name Type Description
from object

The object to copy (the source object).

to object

The object to copy to (the destination object).

Source:
Returns:

The modified destination object.

Type
object

<static> pad(str, len, pad, dir) → {string}

Javascript string pad http://www.webtoolkit.info/. pad = the string to pad it out with (defaults to a space) dir = 1 (left), 2 (right), 3 (both)

Parameters:
Name Type Argument Default Description
str string

The target string.

len number

The number of characters to be added.

pad number

The string to pad it out with (defaults to a space).

dir number <optional>
3

The direction dir = 1 (left), 2 (right), 3 (both).

Source:
Returns:

The padded string

Type
string

<static> parseDimension(size, dimension) → {number}

Get a unit dimension from a string.

Parameters:
Name Type Description
size string | number

The size to parse.

dimension number

The window dimension to check.

Source:
Returns:

The parsed dimension.

Type
number

<static> rotateArray(matrix, direction) → {array}

Rotates the given array. Based on the routine from http://jsfiddle.net/MrPolywhirl/NH42z/

Parameters:
Name Type Description
matrix array

The array to rotate.

direction number | string

The amount to rotate. Either a number: 90, -90, 270, -270, 180 or a string: 'rotateLeft', 'rotateRight' or 'rotate180'

Source:
Returns:

The rotated array

Type
array

<static> setProperty(obj, prop) → {object}

Sets an objects property by string.

Parameters:
Name Type Description
obj object

The object to traverse

prop string

The property whose value will be changed

Source:
Returns:

The object on which the property was set.

Type
object

<static> shuffle(array) → {array}

A standard Fisher-Yates Array shuffle implementation.

Parameters:
Name Type Description
array array

The array to shuffle.

Source:
Returns:

The shuffled array.

Type
array

<static> transposeArray(array) → {array}

Transposes the elements of the given Array.

Parameters:
Name Type Description
array array

The array to transpose.

Source:
Returns:

The transposed array.

Type
array
Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Wed Oct 22 2014 21:46:10 GMT+0100 (BST) using the DocStrap template.