Difference between revisions of "love.graphics.setBackgroundColor"
m (Changed text at top to notice, due to it being a recent but major change.) |
|||
Line 3: | Line 3: | ||
{{notice|In versions prior to [[11.0]], color component values were within the range of 0 to 255 instead of 0 to 1.}} | {{notice|In versions prior to [[11.0]], color component values were within the range of 0 to 255 instead of 0 to 1.}} | ||
== Function == | == Function == | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
Line 35: | Line 11: | ||
{{param|number|green|The green component (0-1).}} | {{param|number|green|The green component (0-1).}} | ||
{{param|number|blue|The blue component (0-1).}} | {{param|number|blue|The blue component (0-1).}} | ||
+ | {{New feature|0.8.0| | ||
{{param|number|alpha|The alpha component (0-1).}} | {{param|number|alpha|The alpha component (0-1).}} | ||
+ | |080}} | ||
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
Line 47: | Line 25: | ||
blue = 135/255 | blue = 135/255 | ||
alpha = 50/100 | alpha = 50/100 | ||
− | love.setBackgroundColor( red, green, blue, alpha) | + | love.graphics.setBackgroundColor( red, green, blue, alpha) |
end | end | ||
</source> | </source> | ||
Line 70: | Line 48: | ||
blue = 36/255 | blue = 36/255 | ||
color = { red, green, blue} | color = { red, green, blue} | ||
− | love.setBackgroundColor( color) | + | love.graphics.setBackgroundColor( color) |
end | end | ||
</source> | </source> | ||
Line 94: | Line 72: | ||
alpha = 50/100 | alpha = 50/100 | ||
color = { red, green, blue, alpha} | color = { red, green, blue, alpha} | ||
− | love.setBackgroundColor( color) | + | love.graphics.setBackgroundColor( color) |
end | end | ||
</source> | </source> | ||
Line 100: | Line 78: | ||
== See Also == | == See Also == | ||
* [[parent::love.graphics]] | * [[parent::love.graphics]] | ||
+ | * [[love.graphics.clear]] | ||
* [[love.graphics.getBackgroundColor]] | * [[love.graphics.getBackgroundColor]] | ||
[[Category:Functions]] | [[Category:Functions]] |
Revision as of 05:25, 17 March 2019
Sets the background color.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. |
Contents
Function
Synopsis
love.graphics.setBackgroundColor( red, green, blue, alpha )
Arguments
number red
- The red component (0-1).
number green
- The green component (0-1).
number blue
- The blue component (0-1).
Available since LÖVE 0.8.0
number alpha
- The alpha component (0-1).
Returns
Nothing.
Example
function love.draw()
-- Set Background Color to #731b87 (115, 27, 135) with an alpha of 50%
-- Note: Remember that Love uses 0-1 and not 0-255
red = 115/255
green = 27/255
blue = 135/255
alpha = 50/100
love.graphics.setBackgroundColor( red, green, blue, alpha)
end
Function
Available since LÖVE 0.7.0 |
This variant is not supported in earlier versions. |
Synopsis
love.graphics.setBackgroundColor( rgb )
Arguments
Returns
Nothing.
Example
function love.draw()
-- Set Background Color to #1b8724 (27, 135, 36)
-- Note: Remember that Love uses 0-1 and not 0-255
red = 27/255
green = 135/255
blue = 36/255
color = { red, green, blue}
love.graphics.setBackgroundColor( color)
end
Function
Available since LÖVE 0.8.0 |
This variant is not supported in earlier versions. |
Synopsis
love.graphics.setBackgroundColor( rgba )
Arguments
Returns
Nothing.
Example
function love.draw()
-- Set Background Color to #731b87 (115, 27, 135) with an alpha of 50%
-- Note: Remember that Love uses 0-1 and not 0-255
red = 115/255
green = 27/255
blue = 135/255
alpha = 50/100
color = { red, green, blue, alpha}
love.graphics.setBackgroundColor( color)
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