Package arc.graphics.g2d
Class SpriteBatch
java.lang.Object
arc.graphics.g2d.Batch
arc.graphics.g2d.SpriteBatch
- All Implemented Interfaces:
Disposable
- Direct Known Subclasses:
SortedSpriteBatch
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
protected final float[]
Fields inherited from class arc.graphics.g2d.Batch
apply, blending, color, colorPacked, combinedMatrix, customShader, idx, lastTexture, mesh, mixColor, mixColorPacked, ownsShader, projectionMatrix, shader, sortAscending, transformMatrix, z
-
Constructor Summary
ConstructorDescriptionConstructs a new SpriteBatch with a size of 4096, one buffer, and the default shader.SpriteBatch
(int size) Constructs a SpriteBatch with one buffer and the default shader.SpriteBatch
(int size, Shader defaultShader) Constructs a new SpriteBatch. -
Method Summary
Modifier and TypeMethodDescriptionstatic Shader
protected void
draw
(TextureRegion region, float x, float y, float originX, float originY, float width, float height, float rotation) protected void
protected void
flush()
Methods inherited from class arc.graphics.g2d.Batch
dispose, draw, getBlending, getColor, getMixColor, getPackedColor, getPackedMixColor, getProjection, getShader, getTransform, setBlending, setColor, setColor, setMixColor, setMixColor, setPackedColor, setPackedMixColor, setProjection, setShader, setShader, setSort, setSortAscending, setTransform, setupMatrices, switchTexture, z
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface arc.util.Disposable
isDisposed
-
Field Details
-
VERTEX_SIZE
public static final int VERTEX_SIZE- See Also:
-
SPRITE_SIZE
public static final int SPRITE_SIZE- See Also:
-
vertices
protected final float[] vertices
-
-
Constructor Details
-
SpriteBatch
public SpriteBatch()Constructs a new SpriteBatch with a size of 4096, one buffer, and the default shader.- See Also:
-
SpriteBatch
public SpriteBatch(int size) Constructs a SpriteBatch with one buffer and the default shader.- See Also:
-
SpriteBatch
Constructs a new SpriteBatch. 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
Batch.setShader(Shader)
.- Parameters:
size
- The max number of sprites in a single batch. Max of 8191.defaultShader
- The default shader to use. This is not owned by the SpriteBatch and must be disposed separately.
-
-
Method Details