cocos2dx中创建裁剪区域 实现在指定区域精灵才能出现

前端之家收集整理的这篇文章主要介绍了cocos2dx中创建裁剪区域 实现在指定区域精灵才能出现前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
sp1 = Sprite::create("CloseNormal.png"); sp1->setPosition(Point(100,-120)); //绘制裁剪区域 CCDrawNode* shap = CCDrawNode::create(); CCPoint point[4] = { ccp(0,0),ccp(200,200),ccp(0,200) }; shap->drawPolygon(point,4,ccc4f(355,255,255),2,ccc4f(255,255)); CCClippingNode* cliper = CCClippingNode::create(); cliper->setStencil(shap); cliper->setAnchorPoint(ccp(.5,.5)); cliper->setPosition(ccp(100,20)); addChild(cliper); //把要滚动的图片加入到裁剪区域 cliper->addChild(sp1); MoveTo * mo = MoveTo::create(5.0f,Point(100,400)); sp1->runAction(mo); 原文链接:https://www.f2er.com/cocos2dx/345023.html

猜你在找的Cocos2d-x相关文章