Difference between revisions of "love.graphics.setColor"
(Added a precision about the use of alpha.) |
|||
Line 43: | Line 43: | ||
[[Category:Functions]] | [[Category:Functions]] | ||
{{#set:Description=Sets the color used for drawing.}} | {{#set:Description=Sets the color used for drawing.}} | ||
+ | == Other Languages == | ||
+ | {{i18n|love.graphics.setColor}} |
Revision as of 20:23, 18 November 2010
Sets the color used for drawing.
Contents
Function
Synopsis
love.graphics.setColor( red, green, blue, alpha )
Arguments
number red
- The amount of red.
number green
- The amount of green.
number blue
- The amount of blue.
number alpha (255)
- The amount of alpha. The alpha value will be applied to all subsequent draw operations, even the drawing of an image.
Returns
Nothing.
Examples
Set draw a red circle and a blue one
love.graphics.setColor(255, 0, 0)
love.graphics.circle(50, 50, 20, 20)
love.graphics.setColor(0, 0, 255)
love.graphics.circle(50, 100, 20, 20)
Display a Venn diagram
function love.load()
baseX = 300
baseY = 400
radius = 100
offsetY = radius*.5*math.sqrt(3)
love.graphics.setBackgroundColor(255,255,255)
end
function love.draw()
love.graphics.setColor(255, 0, 0, 100)
love.graphics.circle('fill', baseX, baseY, radius, 50)
love.graphics.setColor(0, 255, 0, 100)
love.graphics.circle('fill', baseX + radius / 2, baseY - offsetY, radius, 50)
love.graphics.setColor(0, 0, 255, 100)
love.graphics.circle('fill', baseX + radius, baseY, radius, 50)
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