Cocos2dx 截屏

void SaveScreenshot()

{

    CCSize size = CCDirector::sharedDirector()->getWinSize();

    CCRenderTexture* texture = CCRenderTexture::create((int)size.width, (int)size.height);    

    texture->setPosition(ccp(size.width/2, size.height/2));    

    texture->begin();

    CCDirector::sharedDirector()->getRunningScene()->visit();

    texture->end();

    texture->saveToFile("screenshot.png", kCCImageFormatPNG);

}


你可能感兴趣的:(cocos2dx)