In the make_quad() function below, how do I set the default values for the vertex_color array in the quad_t structure?
/* RGBA color */
typedef {
uint8_t r,g,b,a;
} rgba_t;
/* Quad polygon - other members removed */
typedef {
rgba_t vertex_color[ 4 ]
} quad_t;
Elsewhere, a function to make and init a quad:
quad_t *make_quad() {
quad_t *quad = malloc( sizeof( quad_t ) );
quad->vertex_color = ??? /* What goes here? */
return ( quad );
}
Obviously I can do it like this:
quad->vertex_color[ 0 ] = { 0xFF, 0xFF, 0xFF, 0xFF };
...
quad->vertex_color[ 3 ] = { 0xFF, 0xFF, 0xFF, 0xFF };
but this:
quad->vertex_color = {
{ 0xFF, 0xFF, 0xFF, 0xFF },
{ 0xFF, 0xFF, 0xFF, 0xFF },
{ 0xFF, 0xFF, 0xFF, 0xFF },
{ 0xFF, 0xFF, 0xFF, 0xFF }
};
...results in "error: expected expression before '{' token".