In my first oF app, I’ve got a pool of colors that I’d like to pull from at random. It was super easy when I stored them as hex ints (0xff0000), but I need to fade them out as well, so I had to switch to (255, 0, 0, 127) style.
Coming from AS3, I imagined an array of custom rgbColor objects. Structs in C++ seemed similar to this, so I found an example that I thought would work:
in header:
struct rgbColor { int r; int g; int b;};
rgbColor colors[3];
in setup function:
colors =
{
{65,255,245},
{62,192,197},
{248,5,96}
}
This fails with: Expected primary-expression before ‘{’ token
at the opening bracket.
This is the only way I could get it to work:
in header:
struct rgbColor { int r; int g; int b;};
rgbColor colors[3];
in setup function:
rgbColor color0 = {65,255,245};
rgbColor color1 = {62,192,197};
rgbColor color2 = {59,129,150};
colors[0] = color0;
colors[1] = color1;
colors[2] = color2;
Appreciate any help!