forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenderTextureFactory.js
More file actions
34 lines (32 loc) · 1.59 KB
/
Copy pathRenderTextureFactory.js
File metadata and controls
34 lines (32 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var GameObjectFactory = require('../GameObjectFactory');
var RenderTexture = require('./RenderTexture');
/**
* Creates a new Render Texture Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Render Texture Game Object has been built into Phaser.
*
* A Render Texture is a special texture that allows any number of Game Objects to be drawn to it. You can take many complex objects and
* draw them all to this one texture, which can they be used as the texture for other Game Object's. It's a way to generate dynamic
* textures at run-time that are WebGL friendly and don't invoke expensive GPU uploads.
*
* @method Phaser.GameObjects.GameObjectFactory#renderTexture
* @since 3.2.0
*
* @param {number} x - The horizontal position of this Game Object in the world.
* @param {number} y - The vertical position of this Game Object in the world.
* @param {number} [width=32] - The width of the Render Texture.
* @param {number} [height=32] - The height of the Render Texture.
* @property {string} [key] - The texture key to make the RenderTexture from.
* @property {string} [frame] - the frame to make the RenderTexture from.
*
* @return {Phaser.GameObjects.RenderTexture} The Game Object that was created.
*/
GameObjectFactory.register('renderTexture', function (x, y, width, height, key, frame)
{
return this.displayList.add(new RenderTexture(this.scene, x, y, width, height, key, frame));
});