Inherits from NSObject
Declared in KKScreenshot.h

Overview

KKScreenshot allows you to create a screenshot of the entire screen or individual layers.

Tasks

  • + screenshotPathForFile:

    This returns the screenshot path (including filename) for a given file. The path will point to the file in the app’s documents directory.

  • + screenshotWithStartNode:filename:

    This will render all of the nodes in the hierarchy starting with startNode to the given filename and returns an autoreleased instance of the created CCRenderTexture. The filename is created in the app’s documents directory, according to the path provided by screenshotPathForFile.

  • + screenshotWithStartNode:

    Same as above but only returns the CCRenderTexture, doesn’t save to file. This is faster if you don’t need the screenshot as an image file.

Class Methods

screenshotPathForFile:

This returns the screenshot path (including filename) for a given file. The path will point to the file in the app’s documents directory.

+ (NSString *)screenshotPathForFile:(NSString *)file

Discussion

Note that screenshotWithStartNode uses this method to create the full path, you should NOT pass the path returned by screenshotPathForFile to screenshotWithStartNode. But you do need the full path if you want to remove a previously loaded screenshot file texture from CCTextureCache, because the screenshot file will be cached in CCTextureCache not by its filename but by its full path.

Declared In

KKScreenshot.h

screenshotWithStartNode:

Same as above but only returns the CCRenderTexture, doesn’t save to file. This is faster if you don’t need the screenshot as an image file.

+ (CCRenderTexture *)screenshotWithStartNode:(CCNode *)startNode

Declared In

KKScreenshot.h

screenshotWithStartNode:filename:

This will render all of the nodes in the hierarchy starting with startNode to the given filename and returns an autoreleased instance of the created CCRenderTexture. The filename is created in the app’s documents directory, according to the path provided by screenshotPathForFile.

+ (CCRenderTexture *)screenshotWithStartNode:(CCNode *)startNode filename:(NSString *)filename

Discussion

Note: on Mac OS X, the screenshot will not be saved to file, you will have to save the render texture manually because CCRenderTexture currently does not support the saveBuffer method on Mac OS X.

Declared In

KKScreenshot.h