Difference between revisions of "SpriteBatch:bind"
Thejonathann (talk | contribs) |
m (Edited description) |
||
Line 1: | Line 1: | ||
{{newin|[[0.8.0]]|080|type=function|text=It has been renamed from [[SpriteBatch:lock]]}} | {{newin|[[0.8.0]]|080|type=function|text=It has been renamed from [[SpriteBatch:lock]]}} | ||
− | Binds the [[SpriteBatch]] to | + | Binds the [[SpriteBatch]] to memory for more efficient updating. |
Binding a SpriteBatch before updating its content can improve the performance as it doesn't push each update to the graphics card separately. Don't forget to [[SpriteBatch:unbind|unbind]] the SpriteBatch or the updates won't show up. | Binding a SpriteBatch before updating its content can improve the performance as it doesn't push each update to the graphics card separately. Don't forget to [[SpriteBatch:unbind|unbind]] the SpriteBatch or the updates won't show up. | ||
Line 15: | Line 15: | ||
=== Updating a SpriteBatch with binding === | === Updating a SpriteBatch with binding === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | function update_spritebatch( | + | function update_spritebatch(spritebatch) |
− | + | spritebatch:bind() | |
− | for i = 1, | + | for i = 1, 100 do |
− | add_tile( | + | add_tile(spritebatch) |
end | end | ||
− | + | spritebatch:unbind() | |
end | end | ||
</source> | </source> | ||
Line 29: | Line 29: | ||
* [[SpriteBatch:unbind]] | * [[SpriteBatch:unbind]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | {{#set:Description=Binds the SpriteBatch to | + | {{#set:Description=Binds the SpriteBatch to memory for more efficient updating.}} |
== Other Languages == | == Other Languages == | ||
{{i18n|SpriteBatch:bind}} | {{i18n|SpriteBatch:bind}} |
Revision as of 08:49, 1 September 2013
Available since LÖVE 0.8.0 |
It has been renamed from SpriteBatch:lock. |
Binds the SpriteBatch to memory for more efficient updating.
Binding a SpriteBatch before updating its content can improve the performance as it doesn't push each update to the graphics card separately. Don't forget to unbind the SpriteBatch or the updates won't show up.
Contents
Function
Synopsis
SpriteBatch:bind( )
Arguments
None.
Returns
Nothing.
Examples
Updating a SpriteBatch with binding
function update_spritebatch(spritebatch)
spritebatch:bind()
for i = 1, 100 do
add_tile(spritebatch)
end
spritebatch:unbind()
end
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