Difference between revisions of "love.graphics.clear"

m
(Updated for 0.10.0)
Line 1: Line 1:
Clears the screen to the [[love.graphics.setBackgroundColor|background color]].
+
Clears the screen to the [[love.graphics.setBackgroundColor|background color]] in LÖVE 0.9.2 and earlier, or to the specified color in [[0.10.0]] and newer.
  
 
This function is called automatically before [[love.draw]] in the default [[love.run]] function. See the example in [[love.run]] for a typical use of this function.
 
This function is called automatically before [[love.draw]] in the default [[love.run]] function. See the example in [[love.run]] for a typical use of this function.
Line 6: Line 6:
  
 
== Function ==
 
== Function ==
 +
Clears the screen to the background color in 0.9.2 and earlier, or to transparent black (0, 0, 0, 0) in LÖVE [[0.10.0]] and newer.
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
Line 14: Line 15:
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 +
 +
== Function ==
 +
{{newin|[[0.10.0]]|100|type=variant}}
 +
Clears the screen or active [[Canvas]] to the specified color.
 +
=== Synopsis ===
 +
<source lang="lua">
 +
love.graphics.clear( r, g, b, a )
 +
</source>
 +
=== Arguments ===
 +
{{param|number|r|The red channel of the color to clear the screen to.}}
 +
{{param|number|g|The green channel of the color to clear the screen to.}}
 +
{{param|number|b|The blue channel of the color to clear the screen to.}}
 +
{{param|number|a (255)The alpha channel of the color to clear the screen to.}}
 +
=== Returns ===
 +
Nothing.
 +
 +
== Function ==
 +
{{newin|[[0.10.0]]|100|type=variant}}
 +
Clears multiple active [[Canvas]]es to different colors, if multiple Canvases are active at once via [[love.graphics.setCanvas]].
 +
=== Synopsis ===
 +
<source lang="lua">
 +
love.graphics.clear( c1, c2, ... )
 +
</source>
 +
=== Arguments ===
 +
{{param|table|c1|A table in the form of <code>{r, g, b, a}</code> containing the color to clear the first active Canvas to.}}
 +
{{param|table|c2|A table in the form of <code>{r, g, b, a}</code> containing the color to clear the second active Canvas to.}}
 +
{{param|table|...|Additional tables for each active Canvas.}}
 +
=== Returns ===
 +
Nothing.
 +
=== Notes ===
 +
A color must be specified for each active Canvas, when this function variant is used.
 +
 
== See Also ==
 
== See Also ==
 
* [[love.graphics.present]]
 
* [[love.graphics.present]]
 
* [[love.graphics.setBackgroundColor]]
 
* [[love.graphics.setBackgroundColor]]
 
* [[love.graphics.setScissor]]
 
* [[love.graphics.setScissor]]
 +
* [[love.graphics.setCanvas]]
 
* [[parent::love.graphics]]
 
* [[parent::love.graphics]]
 
[[Category:Functions]]
 
[[Category:Functions]]

Revision as of 02:56, 3 November 2015

Clears the screen to the background color in LÖVE 0.9.2 and earlier, or to the specified color in 0.10.0 and newer.

This function is called automatically before love.draw in the default love.run function. See the example in love.run for a typical use of this function.

Note that the scissor area bounds the cleared region.

Function

Clears the screen to the background color in 0.9.2 and earlier, or to transparent black (0, 0, 0, 0) in LÖVE 0.10.0 and newer.

Synopsis

love.graphics.clear( )

Arguments

None.

Returns

Nothing.

Function

Available since LÖVE 0.10.0
This variant is not supported in earlier versions.

Clears the screen or active Canvas to the specified color.

Synopsis

love.graphics.clear( r, g, b, a )

Arguments

number r
The red channel of the color to clear the screen to.
number g
The green channel of the color to clear the screen to.
number b
The blue channel of the color to clear the screen to.
number a (255)The alpha channel of the color to clear the screen to.
Some description goes here.

Returns

Nothing.

Function

Available since LÖVE 0.10.0
This variant is not supported in earlier versions.

Clears multiple active Canvases to different colors, if multiple Canvases are active at once via love.graphics.setCanvas.

Synopsis

love.graphics.clear( c1, c2, ... )

Arguments

table c1
A table in the form of {r, g, b, a} containing the color to clear the first active Canvas to.
table c2
A table in the form of {r, g, b, a} containing the color to clear the second active Canvas to.
table ...
Additional tables for each active Canvas.

Returns

Nothing.

Notes

A color must be specified for each active Canvas, when this function variant is used.

See Also


Other Languages