Hello, I have a struct that defines an RGBA colour:
struct Colour{
float r;
float g;
float b;
float a;
};
Then I have an array of some predefined colours so instead of having to write out something link display.clear(Colour(1.f, 0.f, 0.f, 1.f) I would instead write display.clear(clr::red); So I have an array of colours:
//pre defined colours
Colour colours[6] = {{1.f, 0.f, 0.f, 1.f},
{1.f, 0.f, 0.f, 1.f},
{1.f, 0.f, 0.f, 1.f},
{1.f, 0.f, 0.f, 1.f},
{1.f, 0.f, 0.f, 1.f},
{1.f, 0.f, 0.f, 1.f}};
Now here is my problem. I want to typedef all the elements in the array so instated of writing clr::colours[0] I write clr::red. SO I tried writing them like this and it did not work:
namespace clr{
typedef colours[0] red;
typedef colours[1] green;
typedef colours[2] blue;
typedef colours[3] magenta;
typedef colours[4] white;
typedef colours[5] black;
}//namespace clr
Is this possible or did I just do it wrong? Thanks for any help.