我需要在我的cocos2d
应用程序中截取屏幕截图。即使在堆栈溢出中,我也进行了很多搜索。然后我找到了以下代码:
+(UIImage*) screenshotWithStartNode:(CCNode*)stNode
{
[CCDirector sharedDirector].nextDeltaTimeZero = YES;
CGSize winSize = [[CCDirector sharedDirector] winSize];
CCRenderTexture* renTxture =
[CCRenderTexture renderTextureWithWidth:winSize.width
height:winSize.height];
[renTxture begin];
[stNode visit];
[renTxture end];
return [renTxture getUIImage];
}
现在,
问题:上面的代码给了我整个截图。但我需要自定义的屏幕截图,例如,在CGRect(50,50,100,200)
.
谁能帮帮我吗..?谢谢...