RGB

Previous topic - Next topic

MrTAToad

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.

Moru

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 :-)

MrTAToad

It should work, although if its not futurproof, then it might be an idea not to use it :)

Moru

Yes, go with the global variable instead, that should work for the future too.

Kitty Hello

or try -1 as default, and add some code?  :S

MrTAToad

Would probably be the best way.

Kitty Hello

In the next version, it might work.

MrTAToad

Ah good!