Screenshot support is provided automatically through the Steam Overlay
to every game through Steam and Steamworks provides a set of APIs designed to interact with this system. The Steamworks Screenshots API allows you to take screenshots and add them to a users local screenshot library with additional metadata such as the name of a location in your game or tagging users that appear in the screenshot.
: The Steam Overlay
must be active in your game for the Screenshots system to be available.
Users can press a hotkey controlled by Steam (F12 by default), to trigger a screenshot.
The user can change the hotkey and other screenshot settings that will take effect in any game they play in Steam by going to Settings -> In-Game.
Upon quitting a game the Screenshot Uploader will automatically open with all of the screenshots that were taken during the previous session. Users can disable this behavior by going to Settings -> Cloud and unchecking "Open the screenshot uploader after closing game if screenshots were taken".
The Screenshot Uploader can also be accessed at any time through Steam by going to View -> Screenshots or by clicking on "Screenshots" in the Steam Overlay.
If the user uploads any screenshots they will be visible on their community profile, and your games community hub.
Steam Screenshots API
The Steamworks SDK provides access to ISteamScreenshots
, and enables you to use advanced features and integrate the Steam Screenshots system right into your game for the best experience for your customers.
By default Steam will handle taking screenshots, but you can take over control by hooking the screenshots using ISteamScreenshots::HookScreenshots
. If you're hooking the screenshots you'll be getting a ScreenshotRequested_t
callback when the user presses the screenshot hotkey. You can check if you're currently hooking screenshots with ISteamScreenshots::IsScreenshotsHooked
Regardless of whether you're hooking or not, you will be getting a ScreenshotReady_t
callback when the screenshot has been successfully saved to disk. After receiving this callback you should then check the result, and if it was successful, you can then use the ScreenshotHandle
provided to set tags with:
If you want to take a screenshot either with your own button, or automatically at some point, such as the end of a round, you can do that programmatically with ISteamScreenshots::TriggerScreenshot
or by writing the RGB bytes out with ISteamScreenshots::WriteScreenshot
, or by adding a file from the disk with ISteamScreenshots::AddScreenshotToLibrary