-- 把当前游戏屏幕保存到起来 格式为设置
CCSize size = CCDirector::sharedDirector()->getWinSize(); // 可设置大小
CCRenderTexture* screen = CCRenderTexture::create(size.width, size.height);
CCScene* scene= CCDirector::sharedDirector()->getRunningScene();
screen->begin();
scene->visit();
screen->end(false);// lua 用screen:endToLua()
if(screen->saveToFile("cocos2d-x-screen.png", kCCImageFormatPNG))
{
// kCCImageFormatJPG = 0, 保存格式为jpg
// kCCImageFormatPNG = 1, 保存格式为png
// kCCImageFormatRawData = 2 保存格式为data
CCMessageBox("Print Screen OK!", "Hit");
}
CC_SAFE_DELETE(screen);