diff --git a/build/config.php b/build/config.php index a204cb852..219ea994c 100644 --- a/build/config.php +++ b/build/config.php @@ -92,6 +92,7 @@ + diff --git a/src/core/FlexLayer.js b/src/core/FlexLayer.js new file mode 100644 index 000000000..9724f7cc6 --- /dev/null +++ b/src/core/FlexLayer.js @@ -0,0 +1,62 @@ +/** +* @author Richard Davey +* @copyright 2014 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ + +/** +* A responsive grid layer. +* +* @class Phaser.FlexLayer +* @extends Phaser.Group +* @constructor +* @param {Phaser.ScaleManager} manager - The ScaleManager. +*/ +Phaser.FlexLayer = function (manager, position, bounds, scale) { + + Phaser.Group.call(this, manager.game, null, '__flexLayer' + manager.game.rnd.uuid(), false); + + /** + * @property {Phaser.ScaleManager} scale - A reference to the ScaleManager. + */ + this.manager = manager; + + /** + * @property {Phaser.FlexGrid} grid - A reference to the FlexGrid that owns this layer. + */ + this.grid = manager.grid; + + // Bound to the grid + this.position = position; + this.bounds = bounds; + this.scale = scale; + + this.topLeft = bounds.topLeft; + this.topMiddle = new Phaser.Point(bounds.halfWidth, 0); + this.topRight = bounds.topRight; + + this.bottomLeft = bounds.bottomLeft; + this.bottomMiddle = new Phaser.Point(bounds.halfWidth, bounds.bottom); + this.bottomRight = bounds.bottomRight; + +}; + +Phaser.FlexLayer.prototype = Object.create(Phaser.Group.prototype); +Phaser.FlexLayer.prototype.constructor = Phaser.FlexLayer; + +Phaser.FlexLayer.prototype.resize = function () { + +}; + +Phaser.FlexLayer.prototype.debug = function () { + + this.game.debug.text(this.bounds.width + ' x ' + this.bounds.height, this.bounds.x + 4, this.bounds.y + 16); + this.game.debug.geom(this.bounds, 'rgba(0,0,255,0.9', false); + + this.game.debug.geom(this.topLeft, 'rgba(255,255,255,0.9'); + this.game.debug.geom(this.topMiddle, 'rgba(255,255,255,0.9'); + this.game.debug.geom(this.topRight, 'rgba(255,255,255,0.9'); + + +}; + diff --git a/tasks/manifests/phaser.json b/tasks/manifests/phaser.json index 8050bf834..a55691ccb 100644 --- a/tasks/manifests/phaser.json +++ b/tasks/manifests/phaser.json @@ -24,6 +24,7 @@ "src/core/Group.js", "src/core/World.js", "src/core/FlexGrid.js", + "src/core/FlexLayer.js", "src/core/ScaleManager.js", "src/core/Game.js",