求cocos2dx Android游戲截屏分享功能代碼。多謝多謝
1 回答

犯罪嫌疑人X
TA貢獻(xiàn)2080條經(jīng)驗(yàn) 獲得超4個(gè)贊
getScreenPic()寫(xiě)法如下(Native層):void FruitGameLayer::getScreenPic(){ CCSize size = CCDirector::sharedDirector()->getWinSize(); //定義一個(gè)屏幕大小的渲染紋理 CCRenderTexture* pScreen = CCRenderTexture::create(size.width,size.height, kCCTexture2DPixelFormat_RGBA8888); //獲得當(dāng)前的場(chǎng)景指針 CCScene* pCurScene = CCDirector::sharedDirector()->getRunningScene(); //渲染紋理開(kāi)始捕捉 pScreen->begin(); //當(dāng)前場(chǎng)景參與繪制 pCurScene->visit(); //結(jié)束捕捉 pScreen->end(); //保存為png pScreen->saveToFile("gameScreen.png", kCCImageFormatJPEG); CC_SAFE_DELETE(pScreen);}
- 1 回答
- 0 關(guān)注
- 1185 瀏覽
添加回答
舉報(bào)
0/150
提交
取消