Phaser API Documentation

  Version: 
endDraw([erase])

Description:

Use this method to finish batch drawing to this Render Texture.

Never call this method without first calling beginDraw.

It is faster than calling draw, but you must be very careful to manage the flow of code and remember to call endDraw(). If you don't need to draw large numbers of objects it's much safer and easier to use the draw method instead.

The flow should be:

// Call once:
RenderTexture.beginDraw();

// repeat n times:
RenderTexture.batchDraw();
// or
RenderTexture.batchDrawFrame();

// Call once:
RenderTexture.endDraw();

Do not call any methods other than batchDraw, batchDrawFrame, or endDraw once you have started a batch. Also, be very careful not to destroy this Render Texture while the batch is still open, or call beginDraw again.

Parameters:

name type arguments Default description
erase boolean <optional> false

Draws all objects in this batch using a blend mode of ERASE. This has the effect of erasing any filled pixels in the objects being drawn.

Returns:
Description:

This Render Texture instance.