Skip to content

Commit b4e7da7

Browse files
committed
jsdocs updated.
1 parent c40c140 commit b4e7da7

2 files changed

Lines changed: 51 additions & 8 deletions

File tree

src/core/FlexGrid.js

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@
55
*/
66

77
/**
8-
* A responsive grid manager.
8+
* WARNING: This is an EXPERIMENTAL class. The API will change significantly in the coming versions and is incomplete.
9+
* Please try to avoid using in production games with a long time to build.
10+
* This is also why the documentation is incomplete.
11+
*
12+
* FlexGrid is a a responsive grid manager that works in conjunction with the ScaleManager RESIZE scaling mode and FlexLayers
13+
* to provide for game object positioning in a responsive manner.
914
*
1015
* @class Phaser.FlexGrid
1116
* @constructor
1217
* @param {Phaser.ScaleManager} manager - The ScaleManager.
18+
* @param {number} width - The width of the game.
19+
* @param {number} height - The height of the game.
1320
*/
1421
Phaser.FlexGrid = function (manager, width, height) {
1522

@@ -59,6 +66,13 @@ Phaser.FlexGrid = function (manager, width, height) {
5966

6067
Phaser.FlexGrid.prototype = {
6168

69+
/**
70+
* Sets the core game size. This resets the w/h parameters and bounds.
71+
*
72+
* @method setSize
73+
* @param {number} width - The new dimensions.
74+
* @param {number} height - The new dimensions.
75+
*/
6276
setSize: function (width, height) {
6377

6478
// These are locked and don't change until setSize is called again
@@ -83,6 +97,7 @@ Phaser.FlexGrid.prototype = {
8397
* A fluid layer is centered on the game and maintains its aspect ratio as it scales up and down.
8498
*
8599
* @method createFluidLayer
100+
* @param {array} [children] - An array of children that are used to populate the FlexLayer.
86101
* @return {Phaser.FlexLayer} The Layer object.
87102
*/
88103
createFluidLayer: function (children) {
@@ -106,6 +121,7 @@ Phaser.FlexGrid.prototype = {
106121
* 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.
107122
*
108123
* @method createFullLayer
124+
* @param {array} [children] - An array of children that are used to populate the FlexLayer.
109125
* @return {Phaser.FlexLayer} The Layer object.
110126
*/
111127
createFullLayer: function (children) {
@@ -129,6 +145,7 @@ Phaser.FlexGrid.prototype = {
129145
* A fixed layer is centered on the game and is the size of the required dimensions and is never scaled.
130146
*
131147
* @method createFixedLayer
148+
* @param {array} [children] - An array of children that are used to populate the FlexLayer.
132149
* @return {Phaser.FlexLayer} The Layer object.
133150
*/
134151
createFixedLayer: function (children) {
@@ -148,6 +165,11 @@ Phaser.FlexGrid.prototype = {
148165

149166
},
150167

168+
/**
169+
* Resets the layer children references
170+
*
171+
* @method reset
172+
*/
151173
reset: function () {
152174

153175
for (var i = 0; i < this.layers.length; i++)
@@ -161,12 +183,24 @@ Phaser.FlexGrid.prototype = {
161183

162184
},
163185

186+
/**
187+
* Called when the game container changes dimensions.
188+
*
189+
* @method onResize
190+
* @param {number} width - The new width of the game container.
191+
* @param {number} height - The new height of the game container.
192+
*/
164193
onResize: function (width, height) {
165194

166195
this.refresh(width, height);
167196

168197
},
169198

199+
/**
200+
* Updates all internal vars such as the bounds and scale values.
201+
*
202+
* @method refresh
203+
*/
170204
refresh: function () {
171205

172206
this.multiplier = Math.min((this.manager.height / this.height), (this.manager.width / this.width));
@@ -190,22 +224,26 @@ Phaser.FlexGrid.prototype = {
190224

191225
},
192226

227+
/**
228+
* Call in the render function to output the bounds rects.
229+
*
230+
* @method debug
231+
*/
193232
debug: function () {
194233

195234
// for (var i = 0; i < this.layers.length; i++)
196235
// {
197236
// this.layers[i].debug();
198237
// }
199238

200-
// this.game.debug.text(this.boundsFull.width + ' x ' + this.boundsFull.height, this.boundsFull.x + 4, this.boundsFull.y + 16);
201-
// this.game.debug.geom(this.boundsFull, 'rgba(0,0,255,0.9', false);
239+
this.game.debug.text(this.boundsFull.width + ' x ' + this.boundsFull.height, this.boundsFull.x + 4, this.boundsFull.y + 16);
240+
this.game.debug.geom(this.boundsFull, 'rgba(0,0,255,0.9', false);
202241

203242
this.game.debug.text(this.boundsFluid.width + ' x ' + this.boundsFluid.height, this.boundsFluid.x + 4, this.boundsFluid.y + 16);
204243
this.game.debug.geom(this.boundsFluid, 'rgba(255,0,0,0.9', false);
205244

206-
// this.game.debug.text(this.boundsNone.width + ' x ' + this.boundsNone.height, this.boundsNone.x + 4, this.boundsNone.y + 16);
207-
// this.game.debug.geom(this.boundsNone, 'rgba(0,255,0,0.9', false);
208-
// this.game.debug.text(this.scaleFluid.x + ' x ' + this.scaleFluid.y, this.boundsFluid.x + 4, this.boundsFluid.y + 16);
245+
this.game.debug.text(this.boundsNone.width + ' x ' + this.boundsNone.height, this.boundsNone.x + 4, this.boundsNone.y + 16);
246+
this.game.debug.geom(this.boundsNone, 'rgba(0,255,0,0.9', false);
209247

210248
}
211249

src/core/FlexLayer.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@
55
*/
66

77
/**
8+
* WARNING: This is an EXPERIMENTAL class. The API will change significantly in the coming versions and is incomplete.
9+
* Please try to avoid using in production games with a long time to build.
10+
* This is also why the documentation is incomplete.
11+
*
812
* A responsive grid layer.
913
*
1014
* @class Phaser.FlexLayer
1115
* @extends Phaser.Group
1216
* @constructor
1317
* @param {Phaser.ScaleManager} manager - The ScaleManager.
18+
* @param {Phaser.Point} position - A reference to the Point object used for positioning.
19+
* @param {Phaser.Rectangle} bounds - A reference to the Rectangle used for the layer bounds.
20+
* @param {Phaser.Point} scale - A reference to the Point object used for layer scaling.
1421
*/
1522
Phaser.FlexLayer = function (manager, position, bounds, scale) {
1623

@@ -45,7 +52,6 @@ Phaser.FlexLayer.prototype = Object.create(Phaser.Group.prototype);
4552
Phaser.FlexLayer.prototype.constructor = Phaser.FlexLayer;
4653

4754
Phaser.FlexLayer.prototype.resize = function () {
48-
4955
};
5056

5157
Phaser.FlexLayer.prototype.debug = function () {
@@ -59,4 +65,3 @@ Phaser.FlexLayer.prototype.debug = function () {
5965

6066

6167
};
62-

0 commit comments

Comments
 (0)