Class ScreenshotCapture
Captures a screenshot of a running game after a set number of frames, then exits.
public static class ScreenshotCapture
- Inheritance
-
ScreenshotCapture
Remarks
This exists so the documentation's example screenshots can be produced automatically. It is opt-in
through environment variables and does nothing at all unless
OutputPathVariable is set, so a game shipping against the toolkit carries one
environment-variable read per Run and nothing else.
It is wired into GameExtensions.Run rather than into the scene helpers because running is the
one thing every example does. All of them reach the loop through Run - including the F# and
Visual Basic ports - whereas the scene helpers are each used by only a subset.
Capture is scheduled by frame, not by elapsed time. A fixed delay would photograph a different moment on every run, which matters because most examples are things falling, spinning or settling. Frame scheduling alone is still not enough: IsFixedTimeStep defaults to false, so frame N arrives after a different amount of simulated time on a fast machine than a slow one. Capture therefore forces a fixed timestep, which is what makes the output reproducible rather than merely consistent.
Fields
DefaultFrame
The frame captured when FrameVariable is not set.
public static readonly int DefaultFrame
Field Value
Remarks
Late enough for the first shaders to have compiled and for a scene to have settled into something worth looking at, short enough that capturing sixty examples is not an afternoon.
FrameVariable
Optional. Which frame to capture; defaults to DefaultFrame.
public const string FrameVariable = "STRIDE_TOOLKIT_CAPTURE_FRAME"
Field Value
OutputPathVariable
Set to a file path to enable capture. Nothing happens when it is unset.
public const string OutputPathVariable = "STRIDE_TOOLKIT_CAPTURE"
Field Value
Methods
TrySchedule(Game)
Schedules a capture if the environment asks for one.
public static bool TrySchedule(Game game)
Parameters
gameGameThe game about to run.