bool WorlDWindow::saveSpriteimg(const std::string& filename)
{
bool flag = false;
Size wsize = Director::getInstance()->getWinSize();
CCRenderTexture *texture = CCRenderTexture::create(wsize.wIDth,wsize.height,Texture2D::PixelFormat::RGBA8888,GL_DEPTH24_STENCIL8);
texture->setposition(ccp(0,0));
texture->ignoreAnchorPointForposition(true);
texture->setAnchorPoint(CCPointZero);
texture->beginWithClear(0.0f,0.0f,0.0f);
@H_301_170@ // -- start 需要渲染的节点/Users/topgame1602/Desktop/saveSpriteimg.Js
Node *n = _uiMainNode->getNodeByname("UI");
n->visit();
@H_301_170@ // -- end
texture->end();
@H_301_170@ // 当前渲染的节点
texture->savetofile("aa1.png",kCCImageFormatPNG,true,[=](RenderTexture* t,const std::string& s){
cclog("%s",s.c_str());
});
return flag;
}
总结以上是内存溢出为你收集整理的cocos2d-x 讲节点渲染成图片全部内容,希望文章能够帮你解决cocos2d-x 讲节点渲染成图片所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)