Reputation: 93
I realize that a ccColor3B takes RGB values between 0 and 255, but in a ccColor4F, the values are between 0 and 1.0? I have custom colors I would like to use something like ccColor3B blueColor = ccc3(61, 66, 255);
as a ccColor4F. I've tried dividing by 255 but all of the colors show up as black for some reason. My code looks something like: ccColor4F startColor;
startColor.r = blueColor/255;
startColor.g = blueColor/255;
startColor.b = blueColor/255;
startColor.a = 1.0f;
I'm not sure what I'm doing wrong!
Upvotes: 0
Views: 284
Reputation: 666
You need to deal with each RGB value individually. For example:
startColor.r = blueColor.r / 255.0f;
Or you could just use what's already in place to do that conversion.
From ccTypes.h
:
static inline ccColor4F ccc4FFromccc3B(ccColor3B c)
Upvotes: 1