Author Topic: RGB  (Read 2922 times)

MrTAToad

  • Guest
RGB
« 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.

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1766
    • View Profile
    • Homepage
Re: RGB
« Reply #1 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 :-)

MrTAToad

  • Guest
Re: RGB
« Reply #2 on: 2008-Dec-21 »
It should work, although if its not futurproof, then it might be an idea not to use it :)

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1766
    • View Profile
    • Homepage
Re: RGB
« Reply #3 on: 2008-Dec-22 »
Yes, go with the global variable instead, that should work for the future too.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10682
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: RGB
« Reply #4 on: 2008-Dec-22 »
or try -1 as default, and add some code?  :S

MrTAToad

  • Guest
Re: RGB
« Reply #5 on: 2008-Dec-22 »
Would probably be the best way.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10682
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: RGB
« Reply #6 on: 2009-Apr-17 »
In the next version, it might work.

MrTAToad

  • Guest
Re: RGB
« Reply #7 on: 2009-Apr-18 »
Ah good!