The Problem I'm facing is that I want to make a single structure or container that will contain many variables using the c language. Below you can see that I tried to make a Color type and a function to define one more easily.
// Color Type For reuse
typedef struct Color
{
GLfloat R;
GLfloat G;
GLfloat B;
GLfloat A;
} Color;
// Color Setter to Make using the Color Type Easier
Color DefineColor (GLfloat R,GLfloat G,GLfloat B,GLfloat A)
{
Color NewColor; // Combine GLfloat parameters into a Color Type
NewColor.R = R;
NewColor.G = G;
NewColor.B = B;
NewColor.A = A;
return NewColor;
}
What I'm trying to get at is something like this
typedef struct ColorPalette
{
Color Red = DefineColor(1,0,0,1);
Color Green = DefineColor(0,1,0,1);
Color Blue = DefineColor(0,0,1,1);
Color Violet = DefineColor(1,0,0.5,1);
// ... ect more colors and more colors
} ColorPalette;
So that it could be used as such.
ColorPalette.Red;
or like this
Object.attribute.color = ColorPalette.Violet;
Object.Color.ColorPalette.Red;
finding a way to group variables in this way could be very useful in other parts of Game Programming, Matrices , Data sorting and such.