Difference between revisions of "SpriteBatch:setColor"

m
m
Line 1: Line 1:
 
{{newin|[[0.8.0]]|080|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 clear the color.
+
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.
  
 
The global color set with love.graphics.setColor will not work on the SpriteBatch if any of the sprites has its own color.
 
The global color set with love.graphics.setColor will not work on the SpriteBatch if any of the sprites has its own color.
Line 7: Line 7:
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
SpriteBatch:setColor( )
+
SpriteBatch:setColor( r, g, b, a )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
None.
+
{{param|number|r|The amount of red.}}
 +
{{param|number|g|The amount of green.}}
 +
{{param|number|b|The amount of blue.}}
 +
{{param|number|a (255)|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( r, g, b, a )
+
SpriteBatch:setColor( )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|r|The amount of red.}}
+
None.
{{param|number|g|The amount of green.}}
 
{{param|number|b|The amount of blue.}}
 
{{param|number|a (255)|The amount of alpha.}}
 
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
Line 29: Line 30:
 
== 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.}}

Revision as of 23:42, 2 November 2015

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.

The global color set with love.graphics.setColor will not work on the SpriteBatch if any of the sprites has its own color.

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 (255)
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