Difference between revisions of "SpriteBatch:setColor"
(Added SpriteBatch:setColor.) |
(Updated for 11.0) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | {{newin|[[0.8.0]]|type=method}} | + | {{newin|[[0.8.0]]|080|type=method}} |
− | Sets the color that will be used for the next add and set operations. Calling the function without arguments will | + | Sets the color that will be used for the next add and set operations. Calling the function without arguments will disable all per-sprite colors for the SpriteBatch. |
− | + | In versions prior to [[11.0]], color component values were within the range of 0 to 255 instead of 0 to 1. | |
+ | |||
+ | In version [[0.9.2]] and older, the global color set with love.graphics.setColor will not work on the SpriteBatch if any of the sprites has its own color. | ||
== Function == | == Function == | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | SpriteBatch:setColor( ) | + | SpriteBatch:setColor( r, g, b, a ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
− | + | {{param|number|r|The amount of red.}} | |
+ | {{param|number|g|The amount of green.}} | ||
+ | {{param|number|b|The amount of blue.}} | ||
+ | {{param|number|a (1)|The amount of alpha.}} | ||
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
== Function == | == Function == | ||
+ | Disables all per-sprite colors for this SpriteBatch. | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | SpriteBatch:setColor( | + | SpriteBatch:setColor( ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
− | + | None. | |
− | |||
− | |||
− | |||
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
Line 29: | Line 32: | ||
== See Also == | == See Also == | ||
* [[parent::SpriteBatch]] | * [[parent::SpriteBatch]] | ||
+ | * [[SpriteBatch:getColor]] | ||
+ | * [[SpriteBatch:add]] | ||
+ | * [[SpriteBatch:set]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
{{#set:Description=Sets the color that will be used for the next add or set operations.}} | {{#set:Description=Sets the color that will be used for the next add or set operations.}} |
Latest revision as of 20:17, 1 April 2018
Available since LÖVE 0.8.0 |
This method is not supported in earlier versions. |
Sets the color that will be used for the next add and set operations. Calling the function without arguments will disable all per-sprite colors for the SpriteBatch.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
In version 0.9.2 and older, the global color set with love.graphics.setColor will not work on the SpriteBatch if any of the sprites has its own color.
Contents
Function
Synopsis
SpriteBatch:setColor( r, g, b, a )
Arguments
number r
- The amount of red.
number g
- The amount of green.
number b
- The amount of blue.
number a (1)
- The amount of alpha.
Returns
Nothing.
Function
Disables all per-sprite colors for this SpriteBatch.
Synopsis
SpriteBatch:setColor( )
Arguments
None.
Returns
Nothing.
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