Cocos2d:纯色矩形精灵? [英] Cocos2d: Solid color rectangular sprite?
本文介绍了Cocos2d:纯色矩形精灵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须缺少一些东西!
我想创建一个实心矩形CCSprite,其背景颜色初始化为特定的RGB值。我已经查看了所有的文档,找不到任何东西。
I want to create a solid rectangular CCSprite with a background color initialized to a particular RGB value. I have looked all over the docs and can't find anything.
有没有办法初始化CCSprite的背景到特定的颜色?
我不想为每种颜色添加纯色PNG,我需要。
Is there a way to initialize the background of CCSprite to a specific color? I don't want to have to include a solid color PNG for each colors that I will need.
帮助!
推荐答案
CCSprite
有一个颜色
ccColor3B
:
- (ccColor3B) color [read, assign]
RGB colors: conforms to CCRGBAProtocol protocol
Definition at line 145 of file CCSprite.h.
资料来源: CCSprite 参考。
您可以很容易地构造一个ccColor3B结构, code> ccc3():
You can easily construct a ccColor3B struct using ccc3()
:
ccc3(const GLubyte r, const GLubyte g, const GLubyte b)
参考: ccColor3B 参考。
这篇关于Cocos2d:纯色矩形精灵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文