I'm experiencing a strange issue of ALLEGRO_COLOR definitions having their values disappear when initialized in an array. It seems like it has something to do with function scope.
cout returns '0'.
However,
Properly returns the float value.
Any ideas whats happening here?
You cannot use al_map_rgb (or any other Allegro functions) before you call al_init.
The problem is not initialization in an array, rather it is because of initialization before al_init is called.
ALLEGRO_COLOR mycol() { return al_map_rgb(255,196,127); } int main(int argc , char** argv) { if (!al_init()) {return 0;} ALLEGRO_COLOR c = mycol();/// works fine return 0; }
Thanks for the response, sometimes its simpler than you think I guess.