Phaser API Documentation

drawFillRect(x, y, width, height, color, alpha, [texture], [flipUV])


Pushes a filled rectangle into the vertex batch.

The dimensions are run through Math.floor before the quad is generated.

Rectangle has no transform values and isn't transformed into the local space.

Used for directly batching untransformed rectangles, such as Camera background colors.


name type arguments Default description
x number

Horizontal top left coordinate of the rectangle.

y number

Vertical top left coordinate of the rectangle.

width number

Width of the rectangle.

height number

Height of the rectangle.

color number

Color of the rectangle to draw.

alpha number

Alpha value of the rectangle to draw.

texture WebGLTexture <optional>

WebGLTexture that will be assigned to the current batch if a flush occurs.

flipUV boolean <optional> true

Flip the vertical UV coordinates of the texture before rendering?

Since: 3.50.0