I am having problems initializing members of a struct
Here is the struct I am trying to initialize:
I am trying to pass an array of floats to a function using pointersCode:typedef struct { float Red; float Green; float Blue; float Alpha; } color_t;
Here is a snippet of the function (I augmented other parameters and the rest of the code in the function)
And of course it is giving me the following errors:Code:Light::Light(float * Colors) { Color->Red = Colors[Red]; Color->Green = Colors[Green]; Color->Blue = Colors[Blue]; Color->Alpha = Colors[Alpha]; Material = Materials; }
[errors]
C:\Documents and Settings\Charles Thibault\Desktop\ourengine\LightImplementation.cpp (15) : error C2059: syntax error : 'constant'
C:\Documents and Settings\Charles Thibault\Desktop\ourengine\LightImplementation.cpp (16) : error C2039: 'Color' : is not a member of 'color_t'
c:\documents and settings\charles thibault\desktop\ourengine\light.h(13) : see declaration of 'color_t'
[/errors]
Oh and by the way I '#defined' Red, Green, Blue, and Alpha as 0, 1, 2, and 3, respectively (Yes, I seriously need to do that otherwise I forget what element of the array to use).
EDIT: I don't know if it is legal to have the member variable and the #defines the same words, i.e Red, Gree, Blue and Alpha are the same names for both the members of the struct and the macros
However, I tried taking them out and I am still getting the same errors