Skip to content

Commit 9ad922f

Browse files
committed
Moved renderList to BaseCamera
1 parent bc5b0d8 commit 9ad922f

2 files changed

Lines changed: 36 additions & 34 deletions

File tree

src/cameras/2d/BaseCamera.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,38 @@ var BaseCamera = new Class({
490490
* @since 3.17.0
491491
*/
492492
this._maskCamera = null;
493+
494+
/**
495+
* This array is populated with all of the Game Objects that this Camera has rendered
496+
* in the previous (or current, depending on when you inspect it) frame.
497+
*
498+
* It is cleared at the start of `Camera.preUpdate`, or if the Camera is destroyed.
499+
*
500+
* You should not modify this array as it is used internally by the input system,
501+
* however you can read it as required. Note that Game Objects may appear in this
502+
* list multiple times if they belong to multiple non-exclusive Containers.
503+
*
504+
* @name Phaser.Cameras.Scene2D.BaseCamera#renderList
505+
* @type {Phaser.GameObjects.GameObject[]}
506+
* @since 3.52.0
507+
*/
508+
this.renderList = [];
509+
},
510+
511+
/**
512+
* Adds the given Game Object to this cameras render list.
513+
*
514+
* This is invoked during the rendering stage. Only objects that are actually rendered
515+
* will appear in the render list.
516+
*
517+
* @method Phaser.Cameras.Scene2D.BaseCamera#addToRenderList
518+
* @since 3.52.0
519+
*
520+
* @param {Phaser.GameObjects.GameObject} child - The Game Object to add to the render list.
521+
*/
522+
addToRenderList: function (child)
523+
{
524+
this.renderList.push(child);
493525
},
494526

495527
/**
@@ -878,6 +910,8 @@ var BaseCamera = new Class({
878910
*/
879911
preRender: function ()
880912
{
913+
this.renderList.length = 0;
914+
881915
var width = this.width;
882916
var height = this.height;
883917

@@ -1560,6 +1594,8 @@ var BaseCamera = new Class({
15601594
this.sceneManager.customViewports--;
15611595
}
15621596

1597+
this.renderList = [];
1598+
15631599
this._bounds = null;
15641600

15651601
this.scene = null;

src/cameras/2d/Camera.js

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -206,38 +206,6 @@ var Camera = new Class({
206206
* @since 3.0.0
207207
*/
208208
this._follow = null;
209-
210-
/**
211-
* This array is populated with all of the Game Objects that this Camera has rendered
212-
* in the previous (or current, depending on when you inspect it) frame.
213-
*
214-
* It is cleared at the start of `Camera.preUpdate`, or if the Camera is destroyed.
215-
*
216-
* You should not modify this array as it is used internally by the input system,
217-
* however you can read it as required. Note that Game Objects may appear in this
218-
* list multiple times if they belong to multiple non-exclusive Containers.
219-
*
220-
* @name Phaser.Cameras.Scene2D.Camera#renderList
221-
* @type {Phaser.GameObjects.GameObject[]}
222-
* @since 3.52.0
223-
*/
224-
this.renderList = [];
225-
},
226-
227-
/**
228-
* Adds the given Game Object to this cameras render list.
229-
*
230-
* This is invoked during the rendering stage. Only objects that are actually rendered
231-
* will appear in the render list.
232-
*
233-
* @method Phaser.Cameras.Scene2D.Camera#addToRenderList
234-
* @since 3.52.0
235-
*
236-
* @param {Phaser.GameObjects.GameObject} child - The Game Object to add to the render list.
237-
*/
238-
addToRenderList: function (child)
239-
{
240-
this.renderList.push(child);
241209
},
242210

243211
/**
@@ -827,8 +795,6 @@ var Camera = new Class({
827795

828796
BaseCamera.prototype.destroy.call(this);
829797

830-
this.renderList = [];
831-
832798
this._follow = null;
833799

834800
this.deadzone = null;

0 commit comments

Comments
 (0)