Functions for adding screenshots to the user's screenshot library.
See
Steam Screenshots for more information.
Member Functions
Member functions for
ISteamScreenshots
are called through the global accessor function
SteamScreenshots()
.
AddScreenshotToLibrary
ScreenshotHandle AddScreenshotToLibrary( const char *pchFilename, const char *pchThumbnailFilename, int nWidth, int nHeight );
Name | Type | Description |
pchFilename | const char * | The absolute file path to the JPG, PNG, or TGA screenshot. |
pchThumbnailFilename | const char * | The absolute file path to an optional thumbnail image. This must be 200px wide, as described by k_ScreenshotThumbWidth and the same aspect ratio. Pass NULL if there is no thumbnail, one will be created automatically. |
nWidth | int | The width of the screenshot. |
nHeight | int | The height of the screenshot. |
Adds a screenshot to the user's Steam screenshot library from disk.
Returns: ScreenshotHandleTriggers a
ScreenshotReady_t callback.
The handle to this screenshot that is valid for the duration of the game process and can be used to apply tags.
Returns
INVALID_SCREENSHOT_HANDLE if the file could not be saved.
This call is asynchronous, a
ScreenshotReady_t callback will be sent when the screenshot has finished writing to disk.
AddVRScreenshotToLibrary
ScreenshotHandle AddVRScreenshotToLibrary( EVRScreenshotType eType, const char *pchFilename, const char *pchVRFilename );
Name | Type | Description |
eType | EVRScreenshotType | The type of VR screenshot that this is. |
pchFilename | const char * | The absolute file path to a 2D JPG, PNG, or TGA version of the screenshot for the library view. |
pchVRFilename | const char * | The absolute file path to the VR screenshot, this should be the same type of screenshot specified in eType . |
Adds a VR screenshot to the user's Steam screenshot library from disk in the supported type.
Returns: ScreenshotHandleTriggers a
ScreenshotReady_t callback.
The handle to this screenshot that is valid for the duration of the game process and can be used to apply tags.
Returns
INVALID_SCREENSHOT_HANDLE if the file could not be saved.
This call is asynchronous, a
ScreenshotReady_t callback will be sent when the screenshot has finished writing to disk.
HookScreenshots
void HookScreenshots( bool bHook );
Name | Type | Description |
bHook | bool | Enable (true) or disable (false) hooking? |
Toggles whether the overlay handles screenshots when the user presses the screenshot hotkey, or if the game handles them.
Hooking is disabled by default, and only ever enabled if you do so with this function.
If the hooking is enabled, then the
ScreenshotRequested_t callback will be sent if the user presses the hotkey or when
TriggerScreenshot is called, and then the game is expected to call
WriteScreenshot or
AddScreenshotToLibrary in response.
You can check if hooking is enabled with
IsScreenshotsHooked.
IsScreenshotsHooked
bool IsScreenshotsHooked();
Checks if the app is hooking screenshots, or if the Steam Overlay is handling them.
This can be toggled with
HookScreenshots.
Returns: bool
true if the game is hooking screenshots and is expected to handle them; otherwise,
false.
SetLocation
bool SetLocation( ScreenshotHandle hScreenshot, const char *pchLocation );
Name | Type | Description |
hScreenshot | ScreenshotHandle | The handle to the screenshot to tag. |
pchLocation | const char * | The location in the game where this screenshot was taken. This can not be longer than k_cubUFSTagValueMax. |
Sets optional metadata about a screenshot's location. For example, the name of the map it was taken on.
You can get the handle to tag the screenshot once it has been successfully saved from the
ScreenshotReady_t callback or via the
WriteScreenshot,
AddScreenshotToLibrary,
AddVRScreenshotToLibrary calls.
Returns: bool
true if the location was successfully added to the screenshot.
false if
hScreenshot
was invalid, or
pchLocation
is invalid or too long.
TagPublishedFile
bool TagPublishedFile( ScreenshotHandle hScreenshot, PublishedFileId_t unPublishedFileID );
Name | Type | Description |
hScreenshot | ScreenshotHandle | The handle to the screenshot to tag. |
unPublishedFileID | PublishedFileId_t | The workshop item ID that is in the screenshot. |
Tags a published file as being visible in the screenshot.
You can tag up to the value declared by
k_nScreenshotMaxTaggedPublishedFiles in a single screenshot. Tagging more items than that will just be discarded.
This function has a built in delay before saving the tag which allows you to call it repeatedly for each item.
You can get the handle to tag the screenshot once it has been successfully saved from the
ScreenshotReady_t callback or via the
WriteScreenshot,
AddScreenshotToLibrary,
AddVRScreenshotToLibrary calls.
Returns: bool
TagUser
bool TagUser( ScreenshotHandle hScreenshot, CSteamID steamID );
Name | Type | Description |
hScreenshot | ScreenshotHandle | The handle to the screenshot to tag. |
steamID | CSteamID | The Steam ID of a user that is in the screenshot. |
Tags a Steam user as being visible in the screenshot.
You can tag up to the value declared by
k_nScreenshotMaxTaggedUsers in a single screenshot. Tagging more users than that will just be discarded.
This function has a built in delay before saving the tag which allows you to call it repeatedly for each item.
You can get the handle to tag the screenshot once it has been successfully saved from the
ScreenshotReady_t callback or via the
WriteScreenshot,
AddScreenshotToLibrary,
AddVRScreenshotToLibrary calls.
Returns: bool
TriggerScreenshot
void TriggerScreenshot();
Either causes the Steam Overlay to take a screenshot, or tells your screenshot manager that a screenshot needs to be taken. Depending on the value of
IsScreenshotsHooked.
Returns: void
Triggers a
ScreenshotRequested_t callback.
Triggers a
ScreenshotReady_t callback.
Only causes
ScreenshotRequested_t if hooking has been enabled with
HookScreenshots. Otherwise
ScreenshotReady_t will be called when the screenshot has been saved and added to the library.
WriteScreenshot
ScreenshotHandle WriteScreenshot( void *pubRGB, uint32 cubRGB, int nWidth, int nHeight );
Name | Type | Description |
pubRGB | void * | The buffer containing the raw RGB data from the screenshot. |
cubRGB | uint32 | The size of pubRGB in bytes. |
nWidth | int | The width of the screenshot in pixels. |
nHeight | int | The height of the screenshot in pixels. |
Writes a screenshot to the user's Steam screenshot library given the raw image data, which must be in RGB format.
Returns: ScreenshotHandleTriggers a
ScreenshotReady_t callback.
The handle to this screenshot that is valid for the duration of the game process and can be used to apply tags.
Returns
INVALID_SCREENSHOT_HANDLE if the file could not be saved.
This call is asynchronous, the
ScreenshotReady_t callback will be sent when the screenshot has finished writing to disk.
Callbacks
These are callbacks which can be fired by calling
SteamAPI_RunCallbacks. Many of these will be fired directly in response to the member functions of
ISteamScreenshots
.
ScreenshotReady_t
A screenshot successfully written or otherwise added to the library and can now be tagged.
Name | Type | Description |
m_hLocal | ScreenshotHandle | The screenshot handle that has been written. |
m_eResult | EResult | The result of the operation. Possible values:
|
Associated Functions: WriteScreenshot,
AddScreenshotToLibrary,
TriggerScreenshot,
AddVRScreenshotToLibraryScreenshotRequested_t
A screenshot has been requested by the user from the Steam screenshot hotkey. This will only be called if
HookScreenshots has been enabled, in which case Steam will not take the screenshot itself.
This callback has no fields.
Associated Functions: TriggerScreenshotEnums
These are enums which are defined for use with ISteamScreenshots.
EVRScreenshotType
Describes the type of VR screenshots.
Name | Value | Description |
k_EVRScreenshotType_None | 0 | |
k_EVRScreenshotType_Mono | 1 | |
k_EVRScreenshotType_Stereo | 2 | |
k_EVRScreenshotType_MonoCubemap | 3 | |
k_EVRScreenshotType_MonoPanorama | 4 | |
k_EVRScreenshotType_StereoPanorama | 5 | |
Typedefs
These are typedefs which are defined for use with ISteamScreenshots.
Name | Base type | Description |
ScreenshotHandle | uint32 | Handle to a screenshot. This will be valid for the lifetime of your process, but no longer. |
Constants
These are constants which are defined for use with ISteamScreenshots.
Name | Type | Value | Description |
INVALID_SCREENSHOT_HANDLE | int | 0 | An invalid screenshot handle, this is returned when writing or adding a screenshot has failed. |
k_cubUFSTagTypeMax | int | 255 | Unused. |
k_cubUFSTagValueMax | int | 255 | The maximum length in bytes of a location metadata string set on a screenshot using SetLocation. |
k_nScreenshotMaxTaggedPublishedFiles | uint32 | 32 | The maximum number of workshop items that can be tagged in a screenshot using TagPublishedFile. |
k_nScreenshotMaxTaggedUsers | uint32 | 32 | The maximum number of users that can be tagged in a screenshot using TagUser. |
k_ScreenshotThumbWidth | int | 200 | Required width of a thumbnail provided to AddScreenshotToLibrary. If you do not provide a thumbnail then one will be generated automatically. |
STEAMSCREENSHOTS_INTERFACE_VERSION | const char * | "STEAMSCREENSHOTS_INTERFACE_VERSION003" | |