In 'C' as well as a few other languages you can fill an array or struct via the following or something similar.
however this does not appear to work in C++. Long story short I would like to know why this works.
but this does not,
and if there is a more efficient way to initialize/fill an existing struct than setting the values individually.
note that in both cases "strobe" is a class variable, ie "BEACONLIGHTSPEC *strobe;"
Code:
struct foo = {value 1, value 2, value 3, etc...};
however this does not appear to work in C++. Long story short I would like to know why this works.
Code:
strobe = new BEACONLIGHTSPEC;
strobe->shape = BEACONSHAPE_STAR;
strobe->pos = &strobe_pos;
strobe->col = &strobe_color;
strobe->size = 0.5;
strobe->falloff = 0.2;
strobe->period = 1.0;
strobe->duration = 0.02;
strobe->tofs = 0.0;
strobe->active = true;
AddBeacon (strobe);
but this does not,
Code:
strobe = new BEACONLIGHTSPEC {BEACONSHAPE_STAR, &strobe_pos, &strobe_color, 0.5, 0.2, 1.0, 0.02, 0.0, true};
AddBeacon (strobe);
and if there is a more efficient way to initialize/fill an existing struct than setting the values individually.
note that in both cases "strobe" is a class variable, ie "BEACONLIGHTSPEC *strobe;"