您好我正在尝试用颜色填充原始圆圈,然后将颜色不透明度设置为 50% 透明。我在网上搜索并没有找到任何解决方案,只有 cocos2d-iphone 的东西。我创建了继承自精灵,它确实给我画了一个圆圈。
void CircleSprite::draw(void)
{
glLineWidth(2);
cocos2d::ccDrawColor4B(0, 255, 255, 255);
cocos2d::ccDrawCircle( ccp(100/2, 100/2), 50, CC_DEGREES_TO_RADIANS(90), 50, false);
}
#ifndef __CIRCLESPRITE_H__
#define __CIRCLESPRITE_H__
#include "cocos2d.h"
class CircleSprite : public cocos2d::CCSprite
{
public :
virtual void draw(void);
private:
};
#endif
in the main loop :
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCSprite* cloud = drowCloud();
cloud->setPosition(ccp(cloud->getContentSize().width/2,winSize.height/2));
this->addChild(cloud);
CCSprite* HelloWorld::drowCloud()
{
CCSprite * pCloud = new CircleSprite();
return pCloud;
}