Page 1 of 1

I don't understand the using of RGB in LOVE

Posted: Thu Jun 19, 2014 4:15 pm
by sabino
Hi,
I've just bought an e-book titled "LOVE for Lua Game Programming".
I've read some page and I found this code as example:

love.graphics.setColor(0,0,0,225)
love.graphics.setBackgroundColor(255,153,0)

Why the first line has 4 numbers (RGB is identified by only 3 numbers)?
Thank you!

Re: I don't understand the using of RGB in LOVE

Posted: Thu Jun 19, 2014 4:25 pm
by slime
Hi!

The fourth argument to setColor controls opacity/transparency when drawing. A value of 255 means fully opaque / no transparency, and a value of 0 means fully transparent. Anywhere in between means partial transparency.

Re: I don't understand the using of RGB in LOVE

Posted: Thu Jun 19, 2014 4:47 pm
by kikito
It's actually RGBA (the A defaults to 255) http://en.wikipedia.org/wiki/RGBA_color_space

Re: I don't understand the using of RGB in LOVE

Posted: Thu Jun 19, 2014 8:54 pm
by bartbes
And of course the background is RGB, instead of RGBA because your background can't be transparent (what would be behind it?)

Re: I don't understand the using of RGB in LOVE

Posted: Thu Jun 19, 2014 11:41 pm
by Zilarrezko
bartbes wrote:And of course the background is RGB, instead of RGBA because your background can't be transparent (what would be behind it?)
Conspiracy theory!

Re: I don't understand the using of RGB in LOVE

Posted: Fri Jun 20, 2014 7:48 am
by jjmafiae
Bartbes, I think there might be a secret cookie factory behind it.

Re: I don't understand the using of RGB in LOVE

Posted: Fri Jun 20, 2014 10:19 am
by zorg
bartbes wrote:And of course the background is RGB, instead of RGBA because your background can't be transparent (what would be behind it?)
What about "what is behind it.", e.g. the desktop, or another window, or both, or whatever... though i'm sure that there would be some nontrivial (like cross-platform/windowing system) problems in implementing this, assuming it'd even be possible.