I don't understand the using of RGB in LOVE

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
sabino
Prole
Posts: 4
Joined: Thu Jun 19, 2014 4:10 pm

I don't understand the using of RGB in LOVE

Post 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!
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post 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.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

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

Post by kikito »

It's actually RGBA (the A defaults to 255) http://en.wikipedia.org/wiki/RGBA_color_space
When I write def I mean function.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

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

Post by bartbes »

And of course the background is RGB, instead of RGBA because your background can't be transparent (what would be behind it?)
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

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

Post 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!
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

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

Post by jjmafiae »

Bartbes, I think there might be a secret cookie factory behind it.
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

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

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests