GLBasic forum

Feature request => IDE/Syntax => Topic started by: MrTAToad on 2008-Dec-21

Title: RGB
Post by: MrTAToad on 2008-Dec-21
I would like to be able to use RGB as a default parameter in a function.

Eg :

FUNCTION test:val1%=RGB(255,0,0)

At the moment, the compiler gives an error.
Title: Re: RGB
Post by: Moru on 2008-Dec-21
Put the RGB value in a global variable:

Code (glbasic) Select
default_rgb = RGB(255,0,0)

FUNCTION Draw_circle: x, y, r, col = default_rgb


Haven't tested but should work? I usually write this instead: col = 0xFF0000 but Gernot says that is not futureproof so use on your own risk :-)
Title: Re: RGB
Post by: MrTAToad on 2008-Dec-21
It should work, although if its not futurproof, then it might be an idea not to use it :)
Title: Re: RGB
Post by: Moru on 2008-Dec-22
Yes, go with the global variable instead, that should work for the future too.
Title: Re: RGB
Post by: Kitty Hello on 2008-Dec-22
or try -1 as default, and add some code?  :S
Title: Re: RGB
Post by: MrTAToad on 2008-Dec-22
Would probably be the best way.
Title: Re: RGB
Post by: Kitty Hello on 2009-Apr-17
In the next version, it might work.
Title: Re: RGB
Post by: MrTAToad on 2009-Apr-18
Ah good!