iphone - cocos2d - how to extract rgb from color -



iphone - cocos2d - how to extract rgb from color -

i'm making final part of game tells score is. wanted create flash, dynamic , animated, want score sort of total up, plan making text displayed score closer actual score in each draw event, until reaches total score.

however, want digits of score flash increment, , fade. plan extracting lastly digit score displayed 1 step away, , comparing lastly digit score displayed. then, if different, set color of lastly digit white orange. happen every digit.

but want digits fade downwards white again, need help (i've looked everywhere , can't find answer) need color of every letter, , merge white. don't know how red, greenish , bluish components. here's i've got far:

-(bool) colourcount:(cclabelbmfont*)label currentno:(int)cno targetno:(int)tno { ccarray *characters = [label children]; //-------the code making letters orange go here---------- //below makes color of every letter more white (int i=0; i++; i<[characters count]) { [(ccsprite *)[characters objectatindex:[characters count]-i] setcolor: [self mergefont: [(ccsprite *)[characters objectatindex:[characters count]] color] ] ]; } }

and need function called mergefont takes input of color, makes more white, , returns color. i'm not sure color stored though - int?

thanks

in cccolor3b objects each value stored glubyte

source code cctype:

typedef struct _cccolor3b { glubyte r; glubyte g; glubyte b; } cccolor3b; static inline cccolor3b ccc3(const glubyte r, const glubyte g, const glubyte b) { cccolor3b c = {r, g, b}; homecoming c; } //cccolor3b predefined colors static const cccolor3b ccwhite = {255,255,255}; static const cccolor3b ccyellow = {255,255,0}; static const cccolor3b ccblue = {0,0,255}; static const cccolor3b ccgreen = {0,255,0}; static const cccolor3b ccred = {255,0,0}; static const cccolor3b ccmagenta = {255,0,255}; static const cccolor3b ccblack = {0,0,0}; static const cccolor3b ccorange = {255,127,0}; static const cccolor3b ccgray = {166,166,166};

source:cctypes api

iphone xcode cocos2d-iphone

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -