Here is a cocos2d - iphone into cocos2dx code, the effect of the old code is attachment 1 screenshots, cocos2dx code is attachment 2 screenshots, but can be seen from the attachment 2 pictures, draw out the small transparent elves there will be a space between, I would like to remove these intervals, excuse me. What should I do? Thanks for comment.
CCSprite * GGame::maskArea(cocos2d::CCArray *pointsArr, cocos2d::CCPoint offsetPot)
{
CCSprite *textureSprite= CCSprite::create(“bg_blank_alpha.png”); //Transparent image 640 x 960 pix
textureSprite->setAnchorPoint(ccp(0, 0));
CCSprite *maskSprite= CCSprite::create(“bg_box_futher.png”); //98 x 98 pix Transparent image
CCRenderTexture * renderTexture = CCRenderTexture::create(textureSprite->getTexture()->getContentSizeInPixels().width, textureSprite->getTexture()->getContentSizeInPixels().height);
maskSprite->setBlendFunc((ccBlendFunc){GL_SRC_COLOR, GL_ZERO});
textureSprite->setBlendFunc((ccBlendFunc){GL_ONE_MINUS_DST_ALPHA, GL_ZERO});
renderTexture->begin();
CCPoint oldPot=ccp(-1,-1);
CCObject * obj;
CCARRAY_FOREACH(pointsArr, obj)
{
CCString * key=(CCString *)obj;
CCPoint pot= jewelTypeBoard->getData2d()->posToPot(key->intValue());
pot =ccpAdd(offsetPot, JewelTypeBase::coordinateToPosition(pot));
maskSprite->setPosition(pot);
maskSprite->visit();
oldPot = pot;
}
textureSprite->visit();
renderTexture->end();
。。。。。
}
18_150235_e301ff9fffdec86.jpg (25.0 KB)
5368F17A-6B91-4D07-AB3C-F6ECB4D9622A.png (29.4 KB)