public class

SpriteBatch

extends Shape
java.lang.Object
   ↳ org.andengine.entity.Entity
     ↳ org.andengine.entity.shape.Shape
       ↳ org.andengine.entity.sprite.batch.SpriteBatch
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

TODO TRY DEGENERATE TRIANGLES! TODO Check if there is this multiple-of-X-byte(?) alignment optimization? (c) 2010 Nicolas Gramlich (c) 2011 Zynga Inc.

Summary

Nested Classes
class SpriteBatch.HighPerformanceSpriteBatchVertexBufferObject  
interface SpriteBatch.ISpriteBatchVertexBufferObject  
class SpriteBatch.LowMemorySpriteBatchVertexBufferObject  
Constants
int COLOR_INDEX
int SPRITE_SIZE
int TEXTURECOORDINATES_INDEX_U
int TEXTURECOORDINATES_INDEX_V
int VERTEX_INDEX_X
int VERTEX_INDEX_Y
int VERTEX_SIZE
int VERTICES_PER_SPRITE
[Expand]
Inherited Constants
From interface org.andengine.entity.shape.IShape
Fields
public static final VertexBufferObjectAttributes VERTEXBUFFEROBJECTATTRIBUTES_DEFAULT
protected final int mCapacity
protected int mIndex
protected final SpriteBatch.ISpriteBatchVertexBufferObject mSpriteBatchVertexBufferObject
protected ITexture mTexture
protected int mVertices
[Expand]
Inherited Fields
From class org.andengine.entity.shape.Shape
From class org.andengine.entity.Entity
Public Constructors
SpriteBatch(ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager)
SpriteBatch(float pX, float pY, ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager)
SpriteBatch(ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager, VertexBufferObject.DrawType pDrawType)
SpriteBatch(float pX, float pY, ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager, VertexBufferObject.DrawType pDrawType)
SpriteBatch(ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager, ShaderProgram pShaderProgram)
SpriteBatch(float pX, float pY, ITexture pTexture, VertexBufferObjectManager pVertexBufferObjectManager, int pCapacity, ShaderProgram pShaderProgram)
SpriteBatch(ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager, VertexBufferObject.DrawType pDrawType, ShaderProgram pShaderProgram)
SpriteBatch(float pX, float pY, ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager, VertexBufferObject.DrawType pDrawType, ShaderProgram pShaderProgram)
SpriteBatch(ITexture pTexture, int pCapacity, SpriteBatch.ISpriteBatchVertexBufferObject pSpriteBatchVertexBufferObject)
SpriteBatch(float pX, float pY, ITexture pTexture, int pCapacity, SpriteBatch.ISpriteBatchVertexBufferObject pSpriteBatchVertexBufferObject)
SpriteBatch(ITexture pTexture, int pCapacity, SpriteBatch.ISpriteBatchVertexBufferObject pSpriteBatchVertexBufferObject, ShaderProgram pShaderProgram)
SpriteBatch(float pX, float pY, ITexture pTexture, int pCapacity, SpriteBatch.ISpriteBatchVertexBufferObject pSpriteBatchVertexBufferObject, ShaderProgram pShaderProgram)
Public Methods
boolean collidesWith(IShape pOtherShape)
boolean contains(float pX, float pY)
void dispose()
void draw(Sprite pSprite)
void draw(Sprite pSprite, float pRed, float pGreen, float pBlue, float pAlpha)
void draw(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pScaleX, float pScaleY, float pRed, float pGreen, float pBlue, float pAlpha)
void draw(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRed, float pGreen, float pBlue, float pAlpha)
void draw(ITextureRegion pTextureRegion, float pX1, float pY1, float pX2, float pY2, float pX3, float pY3, float pX4, float pY4, float pRed, float pGreen, float pBlue, float pAlpha)
void draw(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pColorABGRPackedInt)
void draw(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pRed, float pGreen, float pBlue, float pAlpha)
void draw(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pScaleX, float pScaleY, float pRed, float pGreen, float pBlue, float pAlpha)
void draw(Sprite pSprite, float pColorABGRPackedInt)
void drawWithoutChecks(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pColorABGRPackedInt)
void drawWithoutChecks(Sprite pSprite)
void drawWithoutChecks(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pScaleX, float pScaleY, float pRed, float pGreen, float pBlue, float pAlpha)
void drawWithoutChecks(ITextureRegion pTextureRegion, float pX1, float pY1, float pX2, float pY2, float pX3, float pY3, float pX4, float pY4, float pRed, float pGreen, float pBlue, float pAlpha)
void drawWithoutChecks(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRed, float pGreen, float pBlue, float pAlpha)
void drawWithoutChecks(Sprite pSprite, float pColorABGRPackedInt)
void drawWithoutChecks(Sprite pSprite, float pRed, float pGreen, float pBlue, float pAlpha)
void drawWithoutChecks(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pScaleX, float pScaleY, float pRed, float pGreen, float pBlue, float pAlpha)
void drawWithoutChecks(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pRed, float pGreen, float pBlue, float pAlpha)
int getIndex()
ITexture getTexture()
SpriteBatch.ISpriteBatchVertexBufferObject getVertexBufferObject()
void reset()
void setIndex(int pIndex)
void setTexture(ITexture pTexture)
void submit()
Protected Methods
void add(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pRed, float pGreen, float pBlue, float pAlpha)
void add(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pColorABGRPackedInt)
void add(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRed, float pGreen, float pBlue, float pAlpha)
void add(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pScaleX, float pScaleY, float pRed, float pGreen, float pBlue, float pAlpha)
void add(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pScaleX, float pScaleY, float pRed, float pGreen, float pBlue, float pAlpha)
void add(ITextureRegion pTextureRegion, float pWidth, float pHeight, Transformation pTransformation, float pRed, float pGreen, float pBlue, float pAlpha)
void addWithPackedColor(ITextureRegion pTextureRegion, float pWidth, float pHeight, Transformation pTransformation, float pColorABGRPackedInt)
void addWithPackedColor(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pColorABGRPackedInt)
void addWithPackedColor(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pScaleX, float pScaleY, float pColorABGRPackedInt)
void addWithPackedColor(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pColorABGRPackedInt)
void addWithPackedColor(ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pScaleX, float pScaleY, float pColorABGRPackedInt)
void assertTexture(ITextureRegion pTextureRegion)
void begin()
void draw(GLState pGLState, Camera pCamera)
void end()
void onSubmit()
void onUpdateVertices()
void postDraw(GLState pGLState, Camera pCamera)
void preDraw(GLState pGLState, Camera pCamera)
[Expand]
Inherited Methods
From class org.andengine.entity.shape.Shape
From class org.andengine.entity.Entity
From class java.lang.Object
From interface org.andengine.engine.handler.IDrawHandler
From interface org.andengine.engine.handler.IUpdateHandler
From interface org.andengine.entity.IEntity
From interface org.andengine.entity.scene.Scene.ITouchArea
From interface org.andengine.entity.shape.IShape
From interface org.andengine.util.IDisposable

Constants

public static final int COLOR_INDEX

Constant Value: 2 (0x00000002)

public static final int SPRITE_SIZE

Constant Value: 30 (0x0000001e)

public static final int TEXTURECOORDINATES_INDEX_U

Constant Value: 3 (0x00000003)

public static final int TEXTURECOORDINATES_INDEX_V

Constant Value: 4 (0x00000004)

public static final int VERTEX_INDEX_X

Constant Value: 0 (0x00000000)

public static final int VERTEX_INDEX_Y

Constant Value: 1 (0x00000001)

public static final int VERTEX_SIZE

Constant Value: 5 (0x00000005)

public static final int VERTICES_PER_SPRITE

Constant Value: 6 (0x00000006)

Fields

public static final VertexBufferObjectAttributes VERTEXBUFFEROBJECTATTRIBUTES_DEFAULT

protected final int mCapacity

protected int mIndex

protected final SpriteBatch.ISpriteBatchVertexBufferObject mSpriteBatchVertexBufferObject

protected ITexture mTexture

protected int mVertices

Public Constructors

public SpriteBatch (ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager)

public SpriteBatch (float pX, float pY, ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager)

public SpriteBatch (ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager, VertexBufferObject.DrawType pDrawType)

public SpriteBatch (float pX, float pY, ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager, VertexBufferObject.DrawType pDrawType)

public SpriteBatch (ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager, ShaderProgram pShaderProgram)

public SpriteBatch (float pX, float pY, ITexture pTexture, VertexBufferObjectManager pVertexBufferObjectManager, int pCapacity, ShaderProgram pShaderProgram)

public SpriteBatch (ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager, VertexBufferObject.DrawType pDrawType, ShaderProgram pShaderProgram)

public SpriteBatch (float pX, float pY, ITexture pTexture, int pCapacity, VertexBufferObjectManager pVertexBufferObjectManager, VertexBufferObject.DrawType pDrawType, ShaderProgram pShaderProgram)

public SpriteBatch (ITexture pTexture, int pCapacity, SpriteBatch.ISpriteBatchVertexBufferObject pSpriteBatchVertexBufferObject)

public SpriteBatch (float pX, float pY, ITexture pTexture, int pCapacity, SpriteBatch.ISpriteBatchVertexBufferObject pSpriteBatchVertexBufferObject)

public SpriteBatch (ITexture pTexture, int pCapacity, SpriteBatch.ISpriteBatchVertexBufferObject pSpriteBatchVertexBufferObject, ShaderProgram pShaderProgram)

public SpriteBatch (float pX, float pY, ITexture pTexture, int pCapacity, SpriteBatch.ISpriteBatchVertexBufferObject pSpriteBatchVertexBufferObject, ShaderProgram pShaderProgram)

Public Methods

public boolean collidesWith (IShape pOtherShape)

public boolean contains (float pX, float pY)

public void dispose ()

public void draw (Sprite pSprite)

See Also
  • {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float)} {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, Transformation, float)}.

public void draw (Sprite pSprite, float pRed, float pGreen, float pBlue, float pAlpha)

See Also
  • {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float, float, float, float)} {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, Transformation, float, float, float, float)}.

public void draw (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pScaleX, float pScaleY, float pRed, float pGreen, float pBlue, float pAlpha)

See Also
  • {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float, float, float, float, float)}.

public void draw (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRed, float pGreen, float pBlue, float pAlpha)

See Also
  • {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float, float, float)}.

public void draw (ITextureRegion pTextureRegion, float pX1, float pY1, float pX2, float pY2, float pX3, float pY3, float pX4, float pY4, float pRed, float pGreen, float pBlue, float pAlpha)

See Also
  • {@link SpriteBatchVertexBufferObject#addInner(ITextureRegion, float, float, float, float, float, float, float, float, float, float, float)}.

public void draw (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pColorABGRPackedInt)

See Also
  • {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float)}.

public void draw (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pRed, float pGreen, float pBlue, float pAlpha)

See Also
  • {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float, float, float, float)}.

public void draw (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pScaleX, float pScaleY, float pRed, float pGreen, float pBlue, float pAlpha)

See Also
  • {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float, float, float, float, float, float)}.

public void draw (Sprite pSprite, float pColorABGRPackedInt)

See Also
  • {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float)} {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, Transformation, float, float, float, float)}.

public void drawWithoutChecks (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pColorABGRPackedInt)

See Also
  • {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float)}.

public void drawWithoutChecks (Sprite pSprite)

public void drawWithoutChecks (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pScaleX, float pScaleY, float pRed, float pGreen, float pBlue, float pAlpha)

public void drawWithoutChecks (ITextureRegion pTextureRegion, float pX1, float pY1, float pX2, float pY2, float pX3, float pY3, float pX4, float pY4, float pRed, float pGreen, float pBlue, float pAlpha)

public void drawWithoutChecks (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRed, float pGreen, float pBlue, float pAlpha)

public void drawWithoutChecks (Sprite pSprite, float pColorABGRPackedInt)

public void drawWithoutChecks (Sprite pSprite, float pRed, float pGreen, float pBlue, float pAlpha)

public void drawWithoutChecks (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pScaleX, float pScaleY, float pRed, float pGreen, float pBlue, float pAlpha)

public void drawWithoutChecks (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pRed, float pGreen, float pBlue, float pAlpha)

public int getIndex ()

public ITexture getTexture ()

public SpriteBatch.ISpriteBatchVertexBufferObject getVertexBufferObject ()

public void reset ()

public void setIndex (int pIndex)

public void setTexture (ITexture pTexture)

public void submit ()

Protected Methods

protected void add (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pRed, float pGreen, float pBlue, float pAlpha)

Parameters
pRotation around the center (pWidth * 0.5f, pHeight * 0.5f)

protected void add (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pColorABGRPackedInt)

protected void add (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRed, float pGreen, float pBlue, float pAlpha)

protected void add (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pScaleX, float pScaleY, float pRed, float pGreen, float pBlue, float pAlpha)

Parameters
pScaleX around the center (pWidth * 0.5f, pHeight * 0.5f)
pScaleY around the center (pWidth * 0.5f, pHeight * 0.5f)

protected void add (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pScaleX, float pScaleY, float pRed, float pGreen, float pBlue, float pAlpha)

Parameters
pRotation around the center (pWidth * 0.5f, pHeight * 0.5f)
pScaleX around the center (pWidth * 0.5f, pHeight * 0.5f)
pScaleY around the center (pWidth * 0.5f, pHeight * 0.5f)

protected void add (ITextureRegion pTextureRegion, float pWidth, float pHeight, Transformation pTransformation, float pRed, float pGreen, float pBlue, float pAlpha)

protected void addWithPackedColor (ITextureRegion pTextureRegion, float pWidth, float pHeight, Transformation pTransformation, float pColorABGRPackedInt)

protected void addWithPackedColor (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pColorABGRPackedInt)

protected void addWithPackedColor (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pScaleX, float pScaleY, float pColorABGRPackedInt)

Parameters
pScaleX around the center (pWidth * 0.5f, pHeight * 0.5f)
pScaleY around the center (pWidth * 0.5f, pHeight * 0.5f)

protected void addWithPackedColor (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pColorABGRPackedInt)

Parameters
pRotation around the center (pWidth * 0.5f, pHeight * 0.5f)

protected void addWithPackedColor (ITextureRegion pTextureRegion, float pX, float pY, float pWidth, float pHeight, float pRotation, float pScaleX, float pScaleY, float pColorABGRPackedInt)

Parameters
pRotation around the center (pWidth * 0.5f, pHeight * 0.5f)
pScaleX around the center (pWidth * 0.5f, pHeight * 0.5f)
pScaleY around the center (pWidth * 0.5f, pHeight * 0.5f)

protected void assertTexture (ITextureRegion pTextureRegion)

protected void begin ()

protected void draw (GLState pGLState, Camera pCamera)

Parameters
pGLState the currently active GLState i.e. to apply transformations to.
pCamera the currently active Camera i.e. to be used for culling.

protected void end ()

protected void onSubmit ()

protected void onUpdateVertices ()

protected void postDraw (GLState pGLState, Camera pCamera)

Parameters
pGLState the currently active GLState i.e. to apply transformations to.
pCamera the currently active Camera i.e. to be used for culling.

protected void preDraw (GLState pGLState, Camera pCamera)

Parameters
pGLState the currently active GLState i.e. to apply transformations to.
pCamera the currently active Camera i.e. to be used for culling.