Cocos2D 2.0 screenshots on iOS 6

前端 未结 4 993
灰色年华
灰色年华 2020-12-03 18:56

I have an application that takes a screenshot of a scene and saves it to a file. I have this working and the application is on the store. Today, I have downloaded iOS 6 and

4条回答
  •  自闭症患者
    2020-12-03 19:20

    This here works for Cocos2d V3.

    +(UIImage*) screenshotWithStartNode:(CCNode*)startNode
    {
        [CCDirector sharedDirector].nextDeltaTimeZero = YES;
    
        CGSize viewSize = [[CCDirector sharedDirector] viewSize];
        CCRenderTexture* rtx =
        [CCRenderTexture renderTextureWithWidth:viewSize.width
                                         height:viewSize.height];
        [rtx begin];
        [startNode visit];
        [rtx end];
    
        return [rtx getUIImage];
    }
    

提交回复
热议问题