Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | List of all members
G3D::ScreenCapture Class Reference

Handles screenshot and video capture with managed filename generation and Journal output. More...

Public Member Functions

 ScreenCapture (const shared_ptr< GuiTheme > &theme, GApp *app)
 
void endVideoRecording ()
 Ends video recording and automatically handles saving and prompting the use for Journal and filename confirmation. More...
 
String getNextFilenameBase ()
 Returns a uniquely generated path in the configured GApp::Settings::ScreenCapture::outputDirectory. More...
 
bool isVideoRecording ()
 
void onAfterGraphics2D (RenderDevice *rd)
 Used internally by GApp to capture frames. More...
 
void onAfterGraphics3D (RenderDevice *rd)
 Used internally by GApp to capture frames. More...
 
String saveCaptureAs (const String &path, const String &windowTitle="Save Capture", const shared_ptr< Texture > &preview=nullptr, bool flipPreview=false, const String &caption="")
 Prompts the use for a name to save the image or video as and then renames existing temporary file path to the one selected by the user. More...
 
void saveImageGridToJournal (const String &sectionTitle, const Array< shared_ptr< Texture >> &textureArray, int numColumns=3, bool addToSCM=true)
 Filenames and captions are taken from the textureArray. More...
 
void startVideoRecording (const VideoOutput::Settings &settings, bool captureUI=true, bool skipFilenameDialog=false, const String &overrideSavePath=String())
 Starts video recording. More...
 
void takeScreenshot (const String &type="jpg", bool captureUI=true, bool skipFilenameDialog=false, const String &overrideSavePath=String())
 Takes a screenshot and automatically handles saving and prompting the user for Journal and filename confirmation. More...
 

Static Public Member Functions

static void checkAppScmRevision (const String &outputDirectory)
 

Detailed Description

Handles screenshot and video capture with managed filename generation and Journal output.

Allows for easy capture of screenshots and videos to a central directory. Can be safely used separate from the DeveloperWindow GUI to save captures to the same location. Each capture is given a unique generated filename. Allows a single screenshot or video capture at one time.

Will automatically detect a Journal in the output directory and enable saving Journal entries.

See also
Journal

Will automatically detect if app is in an svn repository (if configured) and allow including app svn revision to filenames as well as adding captures to the svn repository via the Journal dialog.

Constructor & Destructor Documentation

◆ ScreenCapture()

G3D::ScreenCapture::ScreenCapture ( const shared_ptr< GuiTheme > &  theme,
GApp app 
)

Member Function Documentation

◆ checkAppScmRevision()

static void G3D::ScreenCapture::checkAppScmRevision ( const String outputDirectory)
static

◆ endVideoRecording()

void G3D::ScreenCapture::endVideoRecording ( )

Ends video recording and automatically handles saving and prompting the use for Journal and filename confirmation.

Will modify Journal (if found) and handle source control changes (if selected). Will remove file if dialog was cancelled.

◆ getNextFilenameBase()

String G3D::ScreenCapture::getNextFilenameBase ( )

Returns a uniquely generated path in the configured GApp::Settings::ScreenCapture::outputDirectory.

Does not contain extension.

◆ isVideoRecording()

bool G3D::ScreenCapture::isVideoRecording ( )

◆ onAfterGraphics2D()

void G3D::ScreenCapture::onAfterGraphics2D ( RenderDevice rd)

Used internally by GApp to capture frames.

◆ onAfterGraphics3D()

void G3D::ScreenCapture::onAfterGraphics3D ( RenderDevice rd)

Used internally by GApp to capture frames.

◆ saveCaptureAs()

String G3D::ScreenCapture::saveCaptureAs ( const String path,
const String windowTitle = "Save Capture",
const shared_ptr< Texture > &  preview = nullptr,
bool  flipPreview = false,
const String caption = "" 
)

Prompts the use for a name to save the image or video as and then renames existing temporary file path to the one selected by the user.

Will modify Journal (if found) and handle source control changes (if selected). Will delete the file if the dialog is cancelled.

If called too soon (less than 1-2 seconds) after startup, s_appScmIsSvn and s_appScmRevision may not yet be initialized, as they are initialized on a detached thread.

Returns
Full path to saved file or empty if save was cancelled.

◆ saveImageGridToJournal()

void G3D::ScreenCapture::saveImageGridToJournal ( const String sectionTitle,
const Array< shared_ptr< Texture >> &  textureArray,
int  numColumns = 3,
bool  addToSCM = true 
)

Filenames and captions are taken from the textureArray.

◆ startVideoRecording()

void G3D::ScreenCapture::startVideoRecording ( const VideoOutput::Settings settings,
bool  captureUI = true,
bool  skipFilenameDialog = false,
const String overrideSavePath = String() 
)

Starts video recording.

Parameters
typeThe screenshot file format saved and file extension. Can use file format supported by Image.
captureUIWhether to include the 2D GUI in the screenshot.
skipFilenameDialogWhere to automatically accept the generated filename and skip showing Journal and filename dialog.
overrideSavePathForce screenshot to save to this path. Can be used with skipFilenameDialog to avoid changing path.

◆ takeScreenshot()

void G3D::ScreenCapture::takeScreenshot ( const String type = "jpg",
bool  captureUI = true,
bool  skipFilenameDialog = false,
const String overrideSavePath = String() 
)

Takes a screenshot and automatically handles saving and prompting the user for Journal and filename confirmation.

Will modify Journal (if found) and handle source control changes (if selected). Will remove file if dialog was cancelled.

Parameters
typeThe screenshot file format saved and file extension. Can use file format supported by Image.
captureUIWhether to include the 2D GUI in the screenshot.
skipFilenameDialogWhere to automatically accept the generated filename and skip showing Journal and Save As dialog.
overrideSavePathForce screenshot to save to this path. Can be used with skipFilenameDialog to avoid changing path.

documentation generated on Wed Nov 24 2021 08:02:00 using doxygen 1.8.15