Hey guys! Several days ago i found a cocs2d-iphone examples “stroke effect for CCLabelTTF objects”. Here is the link to the cocos2d-iphone forum: http://www.cocos2d-iphone.org/forum/topic/12126
I made little modifications in this example and rewrote it for c+*. Here is my code:
<pre>
CCRenderTexture* createStroke
{
for (int i=0; i<360; i+= 15) // you should optimize that for your needs
{
label~~>setPosition)**size, bottomLeft.y + cos)**size)
);
label~~>visit();
}
rt~~>end;
label~~>setPosition(originalPos);
label~~>setColor;
label~~>setBlendFunc(originalBlend);
label~~>setIsVisible;
label~~>setOpacity(originalOpacity);
rt~~>setPosition;
return rt;
}
</pre>
I added “opacity” property and possibility to add Stroke for all CCSprite nodes.
Example of usage:
<pre>
CCSprite* sprite = CCSprite::spriteWithFile;
addChild;
CCRenderTexture* tex = createStroke/*color*/, 50 /*opacity*/);
addChild~~ 1);
Right, thx for solving! I use setAntiAliasTexParameters by default for all my textures
xavi pinol wrote:
Solved with:
> rt->getSprite()->getTexture()->setAntiAliasTexParameters();
>
xavi pinol wrote:
> It actually works on iOS, but I’m having some problems on Android.
>
> I know is sounds weird, but have a look at the screenshots
> …
Hey guys! Several days ago i found a cocs2d-iphone examples “stroke effect for CCLabelTTF objects”. Here is the link to the cocos2d-iphone forum: http://www.cocos2d-iphone.org/forum/topic/12126
>
I made little modifications in this example and rewrote it for c+*. Here is my code:
>
>
I added “opacity” property and possibility to add Stroke for all CCSprite nodes.
>
Example of usage:
>
>
This implementation has some a flaw, and you guys can see it more clearly if the stoke color is light color such as yellow(ccc3(255,255,0)), the fill color is white and the background is black.
Though I’ve tried some other implementations, I’ve not found any implementation better than this.