SpriteBatch

Using a single image, draw any number of identical copies of the image using a single call to love.graphics.draw(). This can be used, for example, to draw repeating copies of a single background image.

A SpriteBatch can be even more useful when the underlying image is a Texture Atlas (a single image file containing many independent images); by adding Quads to the batch, different sub-images from within the atlas can be drawn.


Constructors

love.graphics.newSpriteBatchCreates a new SpriteBatch.

Functions

Object:releaseImmediately destroys the object's Lua reference.
Object:typeGets the type of the object as a string.
Object:typeOfChecks whether an object is of a certain type.
SpriteBatch:addAdds a sprite to the batch.
SpriteBatch:addLayerAdds a sprite to a batch created with an Array Texture.
SpriteBatch:addqAdds a Quad to the batch.
SpriteBatch:attachAttributeAttaches a per-vertex attribute from a Mesh onto this SpriteBatch, for use when drawing.
SpriteBatch:bindBinds the SpriteBatch to memory for more efficient updating.
SpriteBatch:clearRemoves all sprites from the buffer.
SpriteBatch:flushImmediately sends all new and modified sprite data to the graphics card.
SpriteBatch:getBufferSizeGets the maximum number of sprites the SpriteBatch can hold.
SpriteBatch:getColorGets the color that will be used for the next add and set operations.
SpriteBatch:getCountGets the number of sprites currently in the SpriteBatch.
SpriteBatch:getImageReturns the image used by the SpriteBatch.
SpriteBatch:getTextureGets the texture (Image or Canvas) used by the SpriteBatch.
SpriteBatch:setChanges a sprite in the batch.
SpriteBatch:setBufferSizeSets the maximum number of sprites the SpriteBatch can hold.
SpriteBatch:setColorSets the color that will be used for the next add or set operations.
SpriteBatch:setDrawRangeRestricts the drawn sprites in the SpriteBatch to a subset of the total.
SpriteBatch:setImageReplaces the image used for the sprites.
SpriteBatch:setLayerChanges a sprite previously added with add or addLayer, in a batch created with an Array Texture.
SpriteBatch:setTextureSets the texture (Image or Canvas) used for the sprites in the batch.
SpriteBatch:setqChanges a sprite with a quad in the batch.
SpriteBatch:unbindUnbinds the SpriteBatch.

Supertypes

See Also


Other Languages