APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.graphics.g2d

public Class PolygonSpriteBatch

extends Object
implements PolygonBatch
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.graphics.g2d.PolygonBatch, com.badlogic.gdx.graphics.g2d.Batch, com.badlogic.gdx.utils.Disposable
Static Imports
com.badlogic.gdx.graphics.g2d.Sprite.*

A PolygonSpriteBatch is used to draw 2D polygons that reference a texture (region). The class will batch the drawing commands and optimize them for processing by the GPU.

To draw something with a PolygonSpriteBatch one has to first call the PolygonSpriteBatch#begin() method which will setup appropriate render states. When you are done with drawing you have to call PolygonSpriteBatch#end() which will actually draw the things you specified.

All drawing commands of the PolygonSpriteBatch operate in screen coordinates. The screen coordinate system has an x-axis pointing to the right, an y-axis pointing upwards and the origin is in the lower left corner of the screen. You can also provide your own transformation and projection matrices if you so wish.

A PolygonSpriteBatch is managed. In case the OpenGL context is lost all OpenGL resources a PolygonSpriteBatch uses internally get invalidated. A context is lost when a user switches to another application or receives an incoming call on Android. A SpritPolygonSpriteBatcheBatch will be automatically reloaded after the OpenGL context is restored.

A PolygonSpriteBatch is a pretty heavy object so you should only ever have one in your program.

A PolygonSpriteBatch works with OpenGL ES 1.x and 2.0. In the case of a 2.0 context it will use its own custom shader to draw all provided sprites. You can set your own custom shader via setShader(ShaderProgram).

A PolygonSpriteBatch has to be disposed if it is no longer used.

Authors
mzechner, Stefan Bachmann, Nathan Sweet

Field Summary

Modifier and TypeField and Description
private int
private int
private boolean
private int
private int
private final Color
pack-priv float
private final Matrix4
private ShaderProgram
private boolean
private float
private float
private Texture
public int
maxTrianglesInBatch

The maximum number of triangles rendered in one batch so far.

private Mesh
private boolean
private final Matrix4
public int
renderCalls

Number of render calls since the last begin().

private final ShaderProgram
public int
totalRenderCalls

Number of rendering calls, ever.

private final Matrix4
private int
private final short[]
private int
private final float[]

Constructor Summary

AccessConstructor and Description
public
PolygonSpriteBatch()

Constructs a PolygonSpriteBatch with the default shader, 2000 vertices, and 4000 triangles.

public
PolygonSpriteBatch(int
The max number of vertices and number of triangles in a single batch. Max of 32767.
size
)

Constructs a PolygonSpriteBatch with the default shader, size vertices, and size * 2 triangles.

public
PolygonSpriteBatch(int
The max number of vertices and number of triangles in a single batch. Max of 32767.
size
,
ShaderProgram defaultShader)

Constructs a PolygonSpriteBatch with the specified shader, size vertices and size * 2 triangles.

public
PolygonSpriteBatch(int
The max number of vertices in a single batch. Max of 32767.
maxVertices
,
int
The max number of triangles in a single batch.
maxTriangles
,
ShaderProgram
The default shader to use. This is not owned by the PolygonSpriteBatch and must be disposed separately. May be null to use the default shader.
defaultShader
)

Constructs a new PolygonSpriteBatch.

Method Summary

Modifier and TypeMethod and Description
public void
begin()

Implements com.badlogic.gdx.graphics.g2d.Batch.begin.

Sets up the Batch for drawing.

public void
disableBlending()

Implements com.badlogic.gdx.graphics.g2d.Batch.disableBlending.

Disables blending for drawing sprites.

public void
dispose()

Implements com.badlogic.gdx.utils.Disposable.dispose.

Releases all resources of this object.

public void
draw(PolygonRegion region, float x, float y)

Implements com.badlogic.gdx.graphics.g2d.PolygonBatch.draw.

Draws a polygon region with the bottom left corner at x,y having the width and height of the region.

public void
draw(PolygonRegion region, float x, float y, float width, float height)

Implements com.badlogic.gdx.graphics.g2d.PolygonBatch.draw.

Draws a polygon region with the bottom left corner at x,y and stretching the region to cover the given width and height.

public void
draw(PolygonRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)

Implements com.badlogic.gdx.graphics.g2d.PolygonBatch.draw.

Draws the polygon region with the bottom left corner at x,y and stretching the region to cover the given width and height.

public void
draw(Texture texture, float[] polygonVertices, int verticesOffset, int verticesCount, short[] polygonTriangles, int trianglesOffset, int trianglesCount)

Implements com.badlogic.gdx.graphics.g2d.PolygonBatch.draw.

Draws the polygon using the given vertices and triangles.

public void
draw(Texture texture, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels.

public void
draw(Texture texture, float x, float y, float width, float height, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels.

public void
draw(Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels.

public void
draw(Texture texture, float x, float y, float width, float height, float u, float v, float u2, float v2)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels.

public void
draw(Texture texture, float x, float y)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y having the width and height of the texture.

public void
draw(Texture texture, float x, float y, float width, float height)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y and stretching the region to cover the given width and height.

public void
draw(Texture texture, float[] spriteVertices, int offset, int count)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle using the given vertices.

public void
draw(TextureRegion region, float x, float y)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y having the width and height of the region.

public void
draw(TextureRegion region, float x, float y, float width, float height)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y and stretching the region to cover the given width and height.

public void
draw(TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y and stretching the region to cover the given width and height.

public void
draw(TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation, boolean clockwise)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the texture coordinates rotated 90 degrees.

public void
draw(TextureRegion region, float width, float height, Affine2 transform)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle transformed by the given matrix.

public void
enableBlending()

Implements com.badlogic.gdx.graphics.g2d.Batch.enableBlending.

Enables blending for drawing sprites.

public void
end()

Implements com.badlogic.gdx.graphics.g2d.Batch.end.

Finishes off rendering.

public void
flush()

Implements com.badlogic.gdx.graphics.g2d.Batch.flush.

Causes any pending sprites to be rendered, without ending the Batch.

public int
public int
public int
public int
public Color
public float
public Matrix4
getProjectionMatrix()

Implements com.badlogic.gdx.graphics.g2d.Batch.getProjectionMatrix.

Returns the current projection matrix.

public ShaderProgram
public Matrix4
getTransformMatrix()

Implements com.badlogic.gdx.graphics.g2d.Batch.getTransformMatrix.

Returns the current transform matrix.

public boolean
public boolean
public void
setBlendFunction(int srcFunc, int dstFunc)

Implements com.badlogic.gdx.graphics.g2d.Batch.setBlendFunction.

Sets the blending function to be used when rendering sprites.

public void
setBlendFunctionSeparate(int srcFuncColor, int dstFuncColor, int srcFuncAlpha, int dstFuncAlpha)

Implements com.badlogic.gdx.graphics.g2d.Batch.setBlendFunctionSeparate.

Sets separate (color/alpha) blending function to be used when rendering sprites.

public void
setColor(Color tint)

Implements com.badlogic.gdx.graphics.g2d.Batch.setColor.

Sets the color used to tint images when they are added to the Batch.

public void
setColor(float r, float g, float b, float a)

Implements com.badlogic.gdx.graphics.g2d.Batch.setColor.

public void
setPackedColor(float packedColor)

Implements com.badlogic.gdx.graphics.g2d.Batch.setPackedColor.

Sets the rendering color of this Batch, expanding the alpha from 0-254 to 0-255.

public void
setProjectionMatrix(Matrix4 projection)

Implements com.badlogic.gdx.graphics.g2d.Batch.setProjectionMatrix.

Sets the projection matrix to be used by this Batch.

public void
setShader(ShaderProgram shader)

Implements com.badlogic.gdx.graphics.g2d.Batch.setShader.

Sets the shader to be used in a GLES 2.0 environment.

public void
setTransformMatrix(Matrix4 transform)

Implements com.badlogic.gdx.graphics.g2d.Batch.setTransformMatrix.

Sets the transform matrix to be used by this Batch.

protected void
protected void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blendDstFuncback to summary
private int blendDstFunc
blendDstFuncAlphaback to summary
private int blendDstFuncAlpha
blendingDisabledback to summary
private boolean blendingDisabled
blendSrcFuncback to summary
private int blendSrcFunc
blendSrcFuncAlphaback to summary
private int blendSrcFuncAlpha
colorback to summary
private final Color color
colorPackedback to summary
pack-priv float colorPacked
combinedMatrixback to summary
private final Matrix4 combinedMatrix
customShaderback to summary
private ShaderProgram customShader
drawingback to summary
private boolean drawing
invTexHeightback to summary
private float invTexHeight
invTexWidthback to summary
private float invTexWidth
lastTextureback to summary
private Texture lastTexture
maxTrianglesInBatchback to summary
public int maxTrianglesInBatch

The maximum number of triangles rendered in one batch so far.

meshback to summary
private Mesh mesh
ownsShaderback to summary
private boolean ownsShader
projectionMatrixback to summary
private final Matrix4 projectionMatrix
renderCallsback to summary
public int renderCalls

Number of render calls since the last begin().

shaderback to summary
private final ShaderProgram shader
totalRenderCallsback to summary
public int totalRenderCalls

Number of rendering calls, ever. Will not be reset unless set manually.

transformMatrixback to summary
private final Matrix4 transformMatrix
triangleIndexback to summary
private int triangleIndex
trianglesback to summary
private final short[] triangles
vertexIndexback to summary
private int vertexIndex
verticesback to summary
private final float[] vertices

Constructor Detail

PolygonSpriteBatchback to summary
public PolygonSpriteBatch()

Constructs a PolygonSpriteBatch with the default shader, 2000 vertices, and 4000 triangles.

See Also
PolygonSpriteBatch(int, int, ShaderProgram)
PolygonSpriteBatchback to summary
public PolygonSpriteBatch(int size)

Constructs a PolygonSpriteBatch with the default shader, size vertices, and size * 2 triangles.

Parameters
size:int

The max number of vertices and number of triangles in a single batch. Max of 32767.

See Also
PolygonSpriteBatch(int, int, ShaderProgram)
PolygonSpriteBatchback to summary
public PolygonSpriteBatch(int size, ShaderProgram defaultShader)

Constructs a PolygonSpriteBatch with the specified shader, size vertices and size * 2 triangles.

Parameters
size:int

The max number of vertices and number of triangles in a single batch. Max of 32767.

See Also
PolygonSpriteBatch(int, int, ShaderProgram)
PolygonSpriteBatchback to summary
public PolygonSpriteBatch(int maxVertices, int maxTriangles, ShaderProgram defaultShader)

Constructs a new PolygonSpriteBatch. Sets the projection matrix to an orthographic projection with y-axis point upwards, x-axis point to the right and the origin being in the bottom left corner of the screen. The projection will be pixel perfect with respect to the current screen resolution.

The defaultShader specifies the shader to use. Note that the names for uniforms for this default shader are different than the ones expect for shaders set with setShader(ShaderProgram). See SpriteBatch#createDefaultShader().

Parameters
maxVertices:int

The max number of vertices in a single batch. Max of 32767.

maxTriangles:int

The max number of triangles in a single batch.

defaultShader:ShaderProgram

The default shader to use. This is not owned by the PolygonSpriteBatch and must be disposed separately. May be null to use the default shader.

Method Detail

beginback to summary
public void begin()

Implements com.badlogic.gdx.graphics.g2d.Batch.begin.

Doc from com.badlogic.gdx.graphics.g2d.Batch.begin.

Sets up the Batch for drawing. This will disable depth buffer writing. It enables blending and texturing. If you have more texture units enabled than the first one you have to disable them before calling this. Uses a screen coordinate system by default where everything is given in pixels. You can specify your own projection and modelview matrices via setProjectionMatrix(Matrix4) and setTransformMatrix(Matrix4).

Annotations
@Override
disableBlendingback to summary
public void disableBlending()

Implements com.badlogic.gdx.graphics.g2d.Batch.disableBlending.

Doc from com.badlogic.gdx.graphics.g2d.Batch.disableBlending.

Disables blending for drawing sprites. Calling this within begin()/end() will flush the batch.

Annotations
@Override
disposeback to summary
public void dispose()

Implements com.badlogic.gdx.utils.Disposable.dispose.

Doc from com.badlogic.gdx.utils.Disposable.dispose.

Releases all resources of this object.

Annotations
@Override
drawback to summary
public void draw(PolygonRegion region, float x, float y)

Implements com.badlogic.gdx.graphics.g2d.PolygonBatch.draw.

Doc from com.badlogic.gdx.graphics.g2d.PolygonBatch.draw.

Draws a polygon region with the bottom left corner at x,y having the width and height of the region.

Annotations
@Override
drawback to summary
public void draw(PolygonRegion region, float x, float y, float width, float height)

Implements com.badlogic.gdx.graphics.g2d.PolygonBatch.draw.

Doc from com.badlogic.gdx.graphics.g2d.PolygonBatch.draw.

Draws a polygon region with the bottom left corner at x,y and stretching the region to cover the given width and height.

Annotations
@Override
drawback to summary
public void draw(PolygonRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)

Implements com.badlogic.gdx.graphics.g2d.PolygonBatch.draw.

Doc from com.badlogic.gdx.graphics.g2d.PolygonBatch.draw.

Draws the polygon region with the bottom left corner at x,y and stretching the region to cover the given width and height. The polygon region is offset by originX, originY relative to the origin. Scale specifies the scaling factor by which the polygon region should be scaled around originX, originY. Rotation specifies the angle of counter clockwise rotation of the rectangle around originX, originY.

Annotations
@Override
drawback to summary
public void draw(Texture texture, float[] polygonVertices, int verticesOffset, int verticesCount, short[] polygonTriangles, int trianglesOffset, int trianglesCount)

Implements com.badlogic.gdx.graphics.g2d.PolygonBatch.draw.

Doc from com.badlogic.gdx.graphics.g2d.PolygonBatch.draw.

Draws the polygon using the given vertices and triangles. Each vertices must be made up of 5 elements in this order: x, y, color, u, v.

Annotations
@Override
drawback to summary
public void draw(Texture texture, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Doc from com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels. The rectangle is offset by originX, originY relative to the origin. Scale specifies the scaling factor by which the rectangle should be scaled around originX, originY. Rotation specifies the angle of counter clockwise rotation of the rectangle around originX, originY. The portion of the Texture given by srcX, srcY and srcWidth, srcHeight is used. These coordinates and sizes are given in texels. FlipX and flipY specify whether the texture portion should be flipped horizontally or vertically.

Annotations
@Override
drawback to summary
public void draw(Texture texture, float x, float y, float width, float height, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Doc from com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels. The portion of the Texture given by srcX, srcY and srcWidth, srcHeight is used. These coordinates and sizes are given in texels. FlipX and flipY specify whether the texture portion should be flipped horizontally or vertically.

Annotations
@Override
drawback to summary
public void draw(Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Doc from com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels. The portion of the Texture given by srcX, srcY and srcWidth, srcHeight are used. These coordinates and sizes are given in texels.

Annotations
@Override
drawback to summary
public void draw(Texture texture, float x, float y, float width, float height, float u, float v, float u2, float v2)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Doc from com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels. The portion of the Texture given by u, v and u2, v2 are used. These coordinates and sizes are given in texture size percentage. The rectangle will have the given tint Color.

Annotations
@Override
drawback to summary
public void draw(Texture texture, float x, float y)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Doc from com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y having the width and height of the texture.

Annotations
@Override
drawback to summary
public void draw(Texture texture, float x, float y, float width, float height)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Doc from com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y and stretching the region to cover the given width and height.

Annotations
@Override
drawback to summary
public void draw(Texture texture, float[] spriteVertices, int offset, int count)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Doc from com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle using the given vertices. There must be 4 vertices, each made up of 5 elements in this order: x, y, color, u, v. The getColor() from the Batch is not applied.

Annotations
@Override
drawback to summary
public void draw(TextureRegion region, float x, float y)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Doc from com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y having the width and height of the region.

Annotations
@Override
drawback to summary
public void draw(TextureRegion region, float x, float y, float width, float height)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Doc from com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y and stretching the region to cover the given width and height.

Annotations
@Override
drawback to summary
public void draw(TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Doc from com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the bottom left corner at x,y and stretching the region to cover the given width and height. The rectangle is offset by originX, originY relative to the origin. Scale specifies the scaling factor by which the rectangle should be scaled around originX, originY. Rotation specifies the angle of counter clockwise rotation of the rectangle around originX, originY.

Annotations
@Override
drawback to summary
public void draw(TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation, boolean clockwise)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Doc from com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle with the texture coordinates rotated 90 degrees. The bottom left corner at x,y and stretching the region to cover the given width and height. The rectangle is offset by originX, originY relative to the origin. Scale specifies the scaling factor by which the rectangle should be scaled around originX, originY. Rotation specifies the angle of counter clockwise rotation of the rectangle around originX, originY.

Annotations
@Override
drawback to summary
public void draw(TextureRegion region, float width, float height, Affine2 transform)

Implements com.badlogic.gdx.graphics.g2d.Batch.draw.

Doc from com.badlogic.gdx.graphics.g2d.Batch.draw.

Draws a rectangle transformed by the given matrix.

Annotations
@Override
enableBlendingback to summary
public void enableBlending()

Implements com.badlogic.gdx.graphics.g2d.Batch.enableBlending.

Doc from com.badlogic.gdx.graphics.g2d.Batch.enableBlending.

Enables blending for drawing sprites. Calling this within begin()/end() will flush the batch.

Annotations
@Override
endback to summary
public void end()

Implements com.badlogic.gdx.graphics.g2d.Batch.end.

Doc from com.badlogic.gdx.graphics.g2d.Batch.end.

Finishes off rendering. Enables depth writes, disables blending and texturing. Must always be called after a call to begin()

Annotations
@Override
flushback to summary
public void flush()

Implements com.badlogic.gdx.graphics.g2d.Batch.flush.

Doc from com.badlogic.gdx.graphics.g2d.Batch.flush.

Causes any pending sprites to be rendered, without ending the Batch.

Annotations
@Override
getBlendDstFuncback to summary
public int getBlendDstFunc()

Implements com.badlogic.gdx.graphics.g2d.Batch.getBlendDstFunc.

Annotations
@Override
getBlendDstFuncAlphaback to summary
public int getBlendDstFuncAlpha()

Implements com.badlogic.gdx.graphics.g2d.Batch.getBlendDstFuncAlpha.

Annotations
@Override
getBlendSrcFuncback to summary
public int getBlendSrcFunc()

Implements com.badlogic.gdx.graphics.g2d.Batch.getBlendSrcFunc.

Annotations
@Override
getBlendSrcFuncAlphaback to summary
public int getBlendSrcFuncAlpha()

Implements com.badlogic.gdx.graphics.g2d.Batch.getBlendSrcFuncAlpha.

Annotations
@Override
getColorback to summary
public Color getColor()

Implements com.badlogic.gdx.graphics.g2d.Batch.getColor.

Annotations
@Override
getPackedColorback to summary
public float getPackedColor()

Implements com.badlogic.gdx.graphics.g2d.Batch.getPackedColor.

Annotations
@Override
getProjectionMatrixback to summary
public Matrix4 getProjectionMatrix()

Implements com.badlogic.gdx.graphics.g2d.Batch.getProjectionMatrix.

Doc from com.badlogic.gdx.graphics.g2d.Batch.getProjectionMatrix.

Returns the current projection matrix. Changing this within begin()/end() results in undefined behaviour.

Annotations
@Override
getShaderback to summary
public ShaderProgram getShader()

Implements com.badlogic.gdx.graphics.g2d.Batch.getShader.

Annotations
@Override
getTransformMatrixback to summary
public Matrix4 getTransformMatrix()

Implements com.badlogic.gdx.graphics.g2d.Batch.getTransformMatrix.

Doc from com.badlogic.gdx.graphics.g2d.Batch.getTransformMatrix.

Returns the current transform matrix. Changing this within begin()/end() results in undefined behaviour.

Annotations
@Override
isBlendingEnabledback to summary
public boolean isBlendingEnabled()

Implements com.badlogic.gdx.graphics.g2d.Batch.isBlendingEnabled.

Annotations
@Override
isDrawingback to summary
public boolean isDrawing()

Implements com.badlogic.gdx.graphics.g2d.Batch.isDrawing.

Annotations
@Override
setBlendFunctionback to summary
public void setBlendFunction(int srcFunc, int dstFunc)

Implements com.badlogic.gdx.graphics.g2d.Batch.setBlendFunction.

Doc from com.badlogic.gdx.graphics.g2d.Batch.setBlendFunction.

Sets the blending function to be used when rendering sprites.

Annotations
@Override
setBlendFunctionSeparateback to summary
public void setBlendFunctionSeparate(int srcFuncColor, int dstFuncColor, int srcFuncAlpha, int dstFuncAlpha)

Implements com.badlogic.gdx.graphics.g2d.Batch.setBlendFunctionSeparate.

Doc from com.badlogic.gdx.graphics.g2d.Batch.setBlendFunctionSeparate.

Sets separate (color/alpha) blending function to be used when rendering sprites.

Annotations
@Override
setColorback to summary
public void setColor(Color tint)

Implements com.badlogic.gdx.graphics.g2d.Batch.setColor.

Doc from com.badlogic.gdx.graphics.g2d.Batch.setColor.

Sets the color used to tint images when they are added to the Batch. Default is Color#WHITE.

Annotations
@Override
setColorback to summary
public void setColor(float r, float g, float b, float a)

Implements com.badlogic.gdx.graphics.g2d.Batch.setColor.

Annotations
@Override
setPackedColorback to summary
public void setPackedColor(float packedColor)

Implements com.badlogic.gdx.graphics.g2d.Batch.setPackedColor.

Doc from com.badlogic.gdx.graphics.g2d.Batch.setPackedColor.

Sets the rendering color of this Batch, expanding the alpha from 0-254 to 0-255.

Annotations
@Override
setProjectionMatrixback to summary
public void setProjectionMatrix(Matrix4 projection)

Implements com.badlogic.gdx.graphics.g2d.Batch.setProjectionMatrix.

Doc from com.badlogic.gdx.graphics.g2d.Batch.setProjectionMatrix.

Sets the projection matrix to be used by this Batch. If this is called inside a begin()/end() block, the current batch is flushed to the gpu.

Annotations
@Override
setShaderback to summary
public void setShader(ShaderProgram shader)

Implements com.badlogic.gdx.graphics.g2d.Batch.setShader.

Doc from com.badlogic.gdx.graphics.g2d.Batch.setShader.

Sets the shader to be used in a GLES 2.0 environment. Vertex position attribute is called "a_position", the texture coordinates attribute is called "a_texCoord0", the color attribute is called "a_color". See ShaderProgram#POSITION_ATTRIBUTE, ShaderProgram#COLOR_ATTRIBUTE and ShaderProgram#TEXCOORD_ATTRIBUTE which gets "0" appended to indicate the use of the first texture unit. The combined transform and projection matrx is uploaded via a mat4 uniform called "u_projTrans". The texture sampler is passed via a uniform called "u_texture".

Call this method with a null argument to use the default shader.

This method will flush the batch before setting the new shader, you can call it in between begin() and end().

Annotations
@Override
setTransformMatrixback to summary
public void setTransformMatrix(Matrix4 transform)

Implements com.badlogic.gdx.graphics.g2d.Batch.setTransformMatrix.

Doc from com.badlogic.gdx.graphics.g2d.Batch.setTransformMatrix.

Sets the transform matrix to be used by this Batch.

Annotations
@Override
setupMatricesback to summary
protected void setupMatrices()
switchTextureback to summary
protected void switchTexture(Texture texture)