Difference between revisions of "SpriteBatch"
m |
m (Added to PrettyDeprecated) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | 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. | + | 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 with high performance. |
A SpriteBatch can be even more useful when the underlying image is a [http://en.wikipedia.org/wiki/Texture_atlas texture atlas] (a single image file containing many independent images); by adding [[Quad]]s to the batch, different sub-images from within the atlas can be drawn. | A SpriteBatch can be even more useful when the underlying image is a [http://en.wikipedia.org/wiki/Texture_atlas texture atlas] (a single image file containing many independent images); by adding [[Quad]]s to the batch, different sub-images from within the atlas can be drawn. | ||
− | |||
− | |||
== Constructors == | == Constructors == | ||
{{#ask: [[Category:Functions]] [[Constructs::SpriteBatch]] [[Concept:Current]] | {{#ask: [[Category:Functions]] [[Constructs::SpriteBatch]] [[Concept:Current]] | ||
| headers=hide | | headers=hide | ||
| default=None. | | default=None. | ||
+ | | format=template | ||
+ | | template=ListingFields | ||
+ | | introtemplate=ListingIntro | ||
+ | | outrotemplate=ListingOutro | ||
| ?Description | | ?Description | ||
+ | | ?PrettySince | ||
+ | | ?PrettyRemoved | ||
+ | | ?PrettyDeprecated | ||
}} | }} | ||
== Functions == | == Functions == | ||
{{#ask: [[Category:Functions]] [[parent::SpriteBatch||Drawable||Object]] [[Concept:Current]] | {{#ask: [[Category:Functions]] [[parent::SpriteBatch||Drawable||Object]] [[Concept:Current]] | ||
| headers=hide | | headers=hide | ||
+ | | format=template | ||
+ | | template=ListingFields | ||
+ | | introtemplate=ListingIntro | ||
+ | | outrotemplate=ListingOutro | ||
+ | | ?Description | ||
+ | | ?PrettySince | ||
+ | | ?PrettyRemoved | ||
+ | | ?PrettyDeprecated | ||
+ | }} | ||
+ | == Enums == | ||
+ | {{#ask: [[Category:Enums]] [[parent::SpriteBatch||Drawable||Object]] [[Concept:Current]] | ||
+ | | headers=hide | ||
+ | | format=template | ||
+ | | template=ListingFields | ||
+ | | introtemplate=ListingIntro | ||
+ | | outrotemplate=ListingOutro | ||
| ?Description | | ?Description | ||
+ | | ?PrettySince | ||
+ | | ?PrettyRemoved | ||
+ | | ?PrettyDeprecated | ||
}} | }} | ||
== Supertypes == | == Supertypes == | ||
Line 21: | Line 45: | ||
* [[parent::love.graphics]] | * [[parent::love.graphics]] | ||
[[Category:Types]] | [[Category:Types]] | ||
− | {{#set:Description=Store | + | {{#set:Description=Store image positions in a buffer, and draw it in one call.}} |
{{#set:Since=000}} | {{#set:Since=000}} | ||
== Other Languages == | == Other Languages == | ||
{{i18n|SpriteBatch}} | {{i18n|SpriteBatch}} |
Latest revision as of 05:48, 8 July 2019
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 with high performance.
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.newSpriteBatch | Creates a new SpriteBatch. |
Functions
Object:release | Immediately destroys the object's Lua reference. | 11.0 | |
Object:type | Gets the type of the object as a string. | ||
Object:typeOf | Checks whether an object is of a certain type. | ||
SpriteBatch:add | Adds a sprite to the batch. | ||
SpriteBatch:addLayer | Adds a sprite to a batch created with an Array Texture. | 11.0 | |
SpriteBatch:addq | Adds a Quad to the batch. | 0.9.0 | |
SpriteBatch:attachAttribute | Attaches a per-vertex attribute from a Mesh onto this SpriteBatch, for use when drawing. | 0.10.0 | |
SpriteBatch:bind | Binds the SpriteBatch to memory for more efficient updating. | 0.8.0 | 0.10.0 |
SpriteBatch:clear | Removes all sprites from the buffer. | ||
SpriteBatch:flush | Immediately sends all new and modified sprite data to the graphics card. | 0.9.2 | |
SpriteBatch:getBufferSize | Gets the maximum number of sprites the SpriteBatch can hold. | 0.9.0 | |
SpriteBatch:getColor | Gets the color that will be used for the next add and set operations. | 0.9.0 | |
SpriteBatch:getCount | Gets the number of sprites currently in the SpriteBatch. | 0.9.0 | |
SpriteBatch:getImage | Returns the image used by the SpriteBatch. | 0.8.0 | 0.10.0 |
SpriteBatch:getTexture | Gets the texture (Image or Canvas) used by the SpriteBatch. | 0.9.1 | |
SpriteBatch:set | Changes a sprite in the batch. | 0.8.0 | |
SpriteBatch:setBufferSize | Sets the maximum number of sprites the SpriteBatch can hold. | 0.9.0 | 11.0 |
SpriteBatch:setColor | Sets the color that will be used for the next add or set operations. | 0.8.0 | |
SpriteBatch:setDrawRange | Restricts the drawn sprites in the SpriteBatch to a subset of the total. | 11.0 | |
SpriteBatch:setImage | Replaces the image used for the sprites. | 0.7.2 | 0.10.0 |
SpriteBatch:setLayer | Changes a sprite previously added with add or addLayer, in a batch created with an Array Texture. | 11.0 | |
SpriteBatch:setTexture | Sets the texture (Image or Canvas) used for the sprites in the batch. | 0.9.1 | |
SpriteBatch:setq | Changes a sprite with a quad in the batch. | 0.8.0 | 0.9.0 |
SpriteBatch:unbind | Unbinds the SpriteBatch. | 0.8.0 | 0.10.0 |
Enums
BufferDataUsage | Usage hints for SpriteBatches, Meshes, and GraphicsBuffers to optimize data storage and access. | 0.8.0 |
Supertypes
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info