Created
November 28, 2014 05:55
-
-
Save jonyrock/256c0f62201b0b3159ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClippingNode* createClippingNode() { | |
auto cl = ClippingNode::create(); | |
cl->setContentSize(Size(100, 100)); | |
cl->setAnchorPoint(Vec2(0.5, 0.5)); | |
auto stencil = DrawNode::create(); | |
//stencil->drawPoint(Vec2(0,0), 200, Color4F::WHITE); | |
vector<Vec2> pnts; | |
pnts.push_back(Vec2(0,0)); | |
pnts.push_back(Vec2(50,100)); | |
pnts.push_back(Vec2(100, 0)); | |
stencil->drawPolygon(pnts.data(), pnts.size(), Color4F::WHITE, 0, Color4F::WHITE); | |
cl->setStencil(stencil); | |
auto sp = Sprite::create("radgr.png"); | |
sp->setColor(Color3B::GREEN); | |
cl->addChild(sp); | |
stencil->setCameraMask((unsigned short)CameraFlag::USER2); | |
return cl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment