CODE BOUNTY: setDrawColor causes a crash [SOLVED]
5 years ago
https://www.bountysource.com/issues.....causes-a-crash
Current bounty stands at 30$.
[EDIT]
Solved it. Converting data types that were incompatible but didn't give an error message was the issue.
Current bounty stands at 30$.
[EDIT]
Solved it. Converting data types that were incompatible but didn't give an error message was the issue.
//Set draw color based on RGBA data
void xySetDrawColor(int r, int g, int b, int a){
//Set color correction
if(r > 255) r = 255;
if(r < 0) r = 0;
if(g > 255) g = 255;
if(g < 0) g = 0;
if(b > 255) b = 255;
if(b < 0) b = 0;
if(a > 255) a = 255;
if(a < 0) r = 0;
Uint8 _r = r, _g = g, _b = b, _a = a;
SDL_SetRenderDrawColor(gvRender, _r, _g, _b, _a);
};
If A < 0, you have it set R to 0. A is still able to be below 0.