Skip to content
mask a CCSprite with cocos2d-x v2.0
C++ C Objective-C Racket
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CCMask.xcodeproj
CCMask
.gitignore
CCMask_image.png
README.md

README.md

CCMask

CCMask is a class which makes masking in Cocos2D-x v2.0 fairly easy.
You just have to define an object and a mask. And that's it!

Usage:

// Create a mask and an object
CCSprite* mask = CCSprite::create("mask_circle.png");
CCSprite* object = CCSprite::create("HelloWorld.png");
object->setPosition(ccp(mask->getContentSize().width/2, mask->getContentSize().height/2));

// Create a masked image
CCMask* masked = CCMask::create(mask , object);
masked->setPosition(ccp(size.width/2, size.height/2));
this->addChild(masked);

alt text

You can’t perform that action at this time.