new RenderTexture(game, key, width, height)
A RenderTexture is a special texture that allows any displayObject to be rendered to it.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
game |
Phaser.Game | Current game instance. |
||
key |
string | Internal Phaser reference key for the render texture. |
||
width |
number |
<optional> |
100 | The width of the render texture. |
height |
number |
<optional> |
100 | The height of the render texture. |
- Source:
Members
-
game
-
- Source:
Properties:
Name Type Description game
Phaser.Game A reference to the currently running game.
-
key
-
- Source:
Properties:
Name Type Description key
string The key of the RenderTexture in the Cache, if stored there.
-
type
-
- Source:
Properties:
Name Type Description type
number Base Phaser object type.
Methods
-
render(displayObject, position, clear)
-
This function will draw the display object to the texture.
Parameters:
Name Type Description displayObject
Phaser.Sprite | Phaser.Image | Phaser.Text | Phaser.BitmapText | Phaser.Group The display object to render to this texture.
position
Phaser.Point A Point object containing the position to render the display object at.
clear
boolean If true the texture will be cleared before the display object is drawn.
- Source:
-
renderXY(displayObject, x, y, clear)
-
This function will draw the display object to the texture.
Parameters:
Name Type Description displayObject
Phaser.Sprite | Phaser.Image | Phaser.Text | Phaser.BitmapText | Phaser.Group The display object to render to this texture.
x
number The x position to render the object at.
y
number The y position to render the object at.
clear
boolean If true the texture will be cleared before the display object is drawn.
- Source:
-
resize(width, height)
-
Resize this RenderTexture to the given width and height.
Parameters:
Name Type Description width
number The new width of the RenderTexture.
height
number The new height of the RenderTexture.
- Source: