我想在游戏中捕获屏幕截图,并在应用程序上显示捕获的图像,我正在使用cocos 2d-x v2.3 c ++版本。
怎么可能呢?
请帮我
谢谢
最佳答案
您可以使用CCRenderTexture
捕获屏幕截图,以下为代码:
CCRenderTexture* texture = CCRenderTexture::create((int)visibleSize.width, (int)visibleSize.height);
texture->setPosition(ccp(visibleSize.width/2, visibleSize.height/2));
texture->begin();
CCDirector::sharedDirector()->getRunningScene()->visit();
texture->end();
texture->saveToFile("screenshot.png", kCCImageFormatPNG);
但是我不知道如何从这里检索图像:)如果有人知道,也请告诉我。
关于ios - cocos 2d x捕获屏幕截图并在ios c++中立即显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24341987/