|
| 1 | +/** |
| 2 | +* @author Richard Davey <rich@photonstorm.com> |
| 3 | +* @copyright 2014 Photon Storm Ltd. |
| 4 | +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} |
| 5 | +*/ |
| 6 | + |
| 7 | +/** |
| 8 | +* A responsive grid layer. |
| 9 | +* |
| 10 | +* @class Phaser.FlexLayer |
| 11 | +* @extends Phaser.Group |
| 12 | +* @constructor |
| 13 | +* @param {Phaser.ScaleManager} manager - The ScaleManager. |
| 14 | +*/ |
| 15 | +Phaser.FlexLayer = function (manager, position, bounds, scale) { |
| 16 | + |
| 17 | + Phaser.Group.call(this, manager.game, null, '__flexLayer' + manager.game.rnd.uuid(), false); |
| 18 | + |
| 19 | + /** |
| 20 | + * @property {Phaser.ScaleManager} scale - A reference to the ScaleManager. |
| 21 | + */ |
| 22 | + this.manager = manager; |
| 23 | + |
| 24 | + /** |
| 25 | + * @property {Phaser.FlexGrid} grid - A reference to the FlexGrid that owns this layer. |
| 26 | + */ |
| 27 | + this.grid = manager.grid; |
| 28 | + |
| 29 | + // Bound to the grid |
| 30 | + this.position = position; |
| 31 | + this.bounds = bounds; |
| 32 | + this.scale = scale; |
| 33 | + |
| 34 | + this.topLeft = bounds.topLeft; |
| 35 | + this.topMiddle = new Phaser.Point(bounds.halfWidth, 0); |
| 36 | + this.topRight = bounds.topRight; |
| 37 | + |
| 38 | + this.bottomLeft = bounds.bottomLeft; |
| 39 | + this.bottomMiddle = new Phaser.Point(bounds.halfWidth, bounds.bottom); |
| 40 | + this.bottomRight = bounds.bottomRight; |
| 41 | + |
| 42 | +}; |
| 43 | + |
| 44 | +Phaser.FlexLayer.prototype = Object.create(Phaser.Group.prototype); |
| 45 | +Phaser.FlexLayer.prototype.constructor = Phaser.FlexLayer; |
| 46 | + |
| 47 | +Phaser.FlexLayer.prototype.resize = function () { |
| 48 | + |
| 49 | +}; |
| 50 | + |
| 51 | +Phaser.FlexLayer.prototype.debug = function () { |
| 52 | + |
| 53 | + this.game.debug.text(this.bounds.width + ' x ' + this.bounds.height, this.bounds.x + 4, this.bounds.y + 16); |
| 54 | + this.game.debug.geom(this.bounds, 'rgba(0,0,255,0.9', false); |
| 55 | + |
| 56 | + this.game.debug.geom(this.topLeft, 'rgba(255,255,255,0.9'); |
| 57 | + this.game.debug.geom(this.topMiddle, 'rgba(255,255,255,0.9'); |
| 58 | + this.game.debug.geom(this.topRight, 'rgba(255,255,255,0.9'); |
| 59 | + |
| 60 | + |
| 61 | +}; |
| 62 | + |
0 commit comments