WARNING: This is an EXPERIMENTAL class. The API will change significantly in the coming versions and is incomplete.
Please try to avoid using in production games with a long time to build.
This is also why the documentation is incomplete.
FlexGrid is a a responsive grid manager that works in conjunction with the ScaleManager RESIZE scaling mode and FlexLayers
to provide for game object positioning in a responsive manner.
Name | Type | Description |
---|---|---|
manager | Phaser.ScaleManager | The ScaleManager. |
width | number | The width of the game. |
height | number | The height of the game. |
A reference to the currently running Game.
A reference to the ScaleManager.
Name | Type | Description |
---|---|---|
position | Phaser.Point | - |
Name | Type | Description |
---|---|---|
scaleFactor | Phaser.Point | The scale factor based on the game dimensions vs. the scaled dimensions. |
A custom layer is centered on the game and maintains its aspect ratio as it scales up and down.
Name | Type | Argument | Description |
---|---|---|---|
width | number | Width of this layer in pixels. | |
height | number | Height of this layer in pixels. | |
children | Array.<PIXI.DisplayObject> | <optional> | An array of children that are used to populate the FlexLayer. |
The Layer object.
A fixed layer is centered on the game and is the size of the required dimensions and is never scaled.
Name | Type | Argument | Description |
---|---|---|---|
children | Array.<PIXI.DisplayObject> | <optional> | An array of children that are used to populate the FlexLayer. |
The Layer object.
A fluid layer is centered on the game and maintains its aspect ratio as it scales up and down.
Name | Type | Argument | Description |
---|---|---|---|
children | array | <optional> | An array of children that are used to populate the FlexLayer. |
The Layer object.
A full layer is placed at 0,0 and extends to the full size of the game. Children are scaled according to the fluid ratios.
Name | Type | Argument | Description |
---|---|---|---|
children | array | <optional> | An array of children that are used to populate the FlexLayer. |
The Layer object.
Call in the render function to output the bounds rects.
Fits a sprites width to the bounds.
Name | Type | Description |
---|---|---|
sprite | Phaser.Sprite | The Sprite to fit. |
Called when the game container changes dimensions.
Name | Type | Description |
---|---|---|
width | number | The new width of the game container. |
height | number | The new height of the game container. |
Updates all internal vars such as the bounds and scale values.
Resets the layer children references
Sets the core game size. This resets the w/h parameters and bounds.
Name | Type | Description |
---|---|---|
width | number | The new dimensions. |
height | number | The new dimensions. |
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/Phaser.FlexGrid.html