Can you do something like this in verge?
void FadeIn(int duration, int color, int image = screen)
{
//code here
}
//calling the function
FadeIn(500, RGB(255, 255, 255));
Basically, so you can call the function with fewer arguments, and default the rest to set values, as a useful shorthand.
Short answer: No. Instead, either pick up a null value and assign in the function (which is a little pointless, as you may as well just pass screen here):
void FadeIn(int duration, int color, int image)
{
if (image == 0-1) image = screen;
//code here
}
//calling the function
FadeIn(500, RGB(255, 255, 255), 0-1);
Or better write a wrapper function with a different name, as verge does not support overloading:
void FadeIn(int duration, int color, int image)
{
//code here
}
void FadeInScreen(int duration, int color)
{
FadeIn(duration, colour, screen);
}
Original forum post







