cocos2d-objc icon indicating copy to clipboard operation
cocos2d-objc copied to clipboard

Setting colorRGBA does not set alpha

Open Birkemose opened this issue 8 years ago • 5 comments

Setting colorRGBA on CCNodeColor does not set color correctly, unless cascade opacity is enabled.

Birkemose avatar Mar 06 '16 14:03 Birkemose

I honestly don't really understand why color and colorRGBA are separated. Maybe for cascading purposes, I didn't look into that yet. Will see what we can do about it.

s1ddok avatar Mar 06 '16 16:03 s1ddok

I also don't understand why we still maintain types like ccColor4F. The whole color things must be refactored I guess.

s1ddok avatar Mar 06 '16 16:03 s1ddok

The ccColor4F guff was due to die in 4.0 wasn't it?. Suspect it was considered too much of (another) major back compatibility break during the 2.x to 3.x process. Pain though isn't it?

The whole cascade colour/opacity has some serious issues as well. Will try and dig them out and file issues/PRs now this is active again.

richardgroves avatar Mar 06 '16 17:03 richardgroves

CCColor was created to bridge all the different color types. Personally I voted that it should be a simple struct (and work more like CGPoint), and I have always hated that CCColor is immutable.

color just sets the color, and not opacity. This is how cocos2d always worked. colorRGBA was added to be able to set a color including opacity.

As mentioned, the cascade functionality has some issues, like the one I just reported.

Birkemose avatar Mar 06 '16 17:03 Birkemose

Making it a struct would be much better, but Obj-C doesn't have methods for structs as Swift has :(

s1ddok avatar Mar 06 '16 17:03 s1ddok