Screenshot support is provided automatically through the Overlay di Steam
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. Alla ricezione della richiamata è necessario controllare il risultato. In caso di esito corretto, puoi utilizzare l'handle ScreenshotHandle
fornito per impostare i tag con:
Se desideri abilitare l'acquisizione di screenshot con un pulsante o in modo automatico in determinati punti del gioco, come al termine di un round, puoi implementare la funzione a livello di programmazione con ISteamScreenshots::TriggerScreenshot
, scrivendo i byte RGB con ISteamScreenshots::WriteScreenshot
o aggiungendo un file dal disco con ISteamScreenshots::AddScreenshotToLibrary