Skip to content

Commit 1d0b5cc

Browse files
committed
Added Size component
1 parent fcf0867 commit 1d0b5cc

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/gameobjects/mesh/Mesh.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ var Model = require('../../geom/mesh/Model');
3636
* @extends Phaser.GameObjects.Components.Transform
3737
* @extends Phaser.GameObjects.Components.Visible
3838
* @extends Phaser.GameObjects.Components.ScrollFactor
39+
* @extends Phaser.GameObjects.Components.Size
3940
*
4041
* @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.
4142
* @param {number} [x] - The horizontal position of this Game Object in the world.
@@ -61,6 +62,7 @@ var Mesh = new Class({
6162
Components.Transform,
6263
Components.Visible,
6364
Components.ScrollFactor,
65+
Components.Size,
6466
MeshRender
6567
],
6668

@@ -110,7 +112,10 @@ var Mesh = new Class({
110112
*/
111113
this.debugGraphic = null;
112114

115+
var renderer = scene.sys.renderer;
116+
113117
this.setPosition(x, y);
118+
this.setSize(renderer.width, renderer.height);
114119

115120
this.initPipeline();
116121

@@ -488,10 +493,8 @@ var Mesh = new Class({
488493
*/
489494
preUpdate: function (time, delta)
490495
{
491-
var renderer = this.scene.sys.renderer;
492-
493-
var width = renderer.width;
494-
var height = renderer.height;
496+
var width = this.width;
497+
var height = this.height;
495498

496499
var camera = this.camera;
497500

@@ -548,7 +551,8 @@ var Mesh = new Class({
548551
},
549552

550553
/**
551-
* Handles the pre-destroy step for the Mesh, which removes the Animation component and typed arrays.
554+
* The destroy step for the Mesh, which removes all models, destroys the camera and
555+
* nulls references.
552556
*
553557
* @method Phaser.GameObjects.Mesh#preDestroy
554558
* @private

0 commit comments

Comments
 (0)