isteamscreenshots.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //====== Copyright � 1996-2008, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: public interface to user remote file storage in Steam
  4. //
  5. //=============================================================================
  6. #ifndef ISTEAMSCREENSHOTS_H
  7. #define ISTEAMSCREENSHOTS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "isteamclient.h"
  12. const uint32 k_nScreenshotMaxTaggedUsers = 32;
  13. const uint32 k_nScreenshotMaxTaggedPublishedFiles = 32;
  14. const int k_cubUFSTagTypeMax = 255;
  15. const int k_cubUFSTagValueMax = 255;
  16. // Required with of a thumbnail provided to AddScreenshotToLibrary. If you do not provide a thumbnail
  17. // one will be generated.
  18. const int k_ScreenshotThumbWidth = 200;
  19. // Handle is valid for the lifetime of your process and no longer
  20. typedef uint32 ScreenshotHandle;
  21. #define INVALID_SCREENSHOT_HANDLE 0
  22. enum EVRScreenshotType
  23. {
  24. k_EVRScreenshotType_None = 0,
  25. k_EVRScreenshotType_Mono = 1,
  26. k_EVRScreenshotType_Stereo = 2,
  27. k_EVRScreenshotType_MonoCubemap = 3,
  28. k_EVRScreenshotType_MonoPanorama = 4,
  29. k_EVRScreenshotType_StereoPanorama = 5
  30. };
  31. //-----------------------------------------------------------------------------
  32. // Purpose: Functions for adding screenshots to the user's screenshot library
  33. //-----------------------------------------------------------------------------
  34. class ISteamScreenshots
  35. {
  36. public:
  37. // Writes a screenshot to the user's screenshot library given the raw image data, which must be in RGB format.
  38. // The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
  39. virtual ScreenshotHandle WriteScreenshot( void *pubRGB, uint32 cubRGB, int nWidth, int nHeight ) = 0;
  40. // Adds a screenshot to the user's screenshot library from disk. If a thumbnail is provided, it must be 200 pixels wide and the same aspect ratio
  41. // as the screenshot, otherwise a thumbnail will be generated if the user uploads the screenshot. The screenshots must be in either JPEG or TGA format.
  42. // The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
  43. // JPEG, TGA, and PNG formats are supported.
  44. virtual ScreenshotHandle AddScreenshotToLibrary( const char *pchFilename, const char *pchThumbnailFilename, int nWidth, int nHeight ) = 0;
  45. // Causes the Steam overlay to take a screenshot. If screenshots are being hooked by the game then a ScreenshotRequested_t callback is sent back to the game instead.
  46. virtual void TriggerScreenshot() = 0;
  47. // Toggles whether the overlay handles screenshots when the user presses the screenshot hotkey, or the game handles them. If the game is hooking screenshots,
  48. // then the ScreenshotRequested_t callback will be sent if the user presses the hotkey, and the game is expected to call WriteScreenshot or AddScreenshotToLibrary
  49. // in response.
  50. virtual void HookScreenshots( bool bHook ) = 0;
  51. // Sets metadata about a screenshot's location (for example, the name of the map)
  52. virtual bool SetLocation( ScreenshotHandle hScreenshot, const char *pchLocation ) = 0;
  53. // Tags a user as being visible in the screenshot
  54. virtual bool TagUser( ScreenshotHandle hScreenshot, CSteamID steamID ) = 0;
  55. // Tags a published file as being visible in the screenshot
  56. virtual bool TagPublishedFile( ScreenshotHandle hScreenshot, PublishedFileId_t unPublishedFileID ) = 0;
  57. // Returns true if the app has hooked the screenshot
  58. virtual bool IsScreenshotsHooked() = 0;
  59. // Adds a VR screenshot to the user's screenshot library from disk in the supported type.
  60. // pchFilename should be the normal 2D image used in the library view
  61. // pchVRFilename should contain the image that matches the correct type
  62. // The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
  63. // JPEG, TGA, and PNG formats are supported.
  64. virtual ScreenshotHandle AddVRScreenshotToLibrary( EVRScreenshotType eType, const char *pchFilename, const char *pchVRFilename ) = 0;
  65. };
  66. #define STEAMSCREENSHOTS_INTERFACE_VERSION "STEAMSCREENSHOTS_INTERFACE_VERSION003"
  67. // callbacks
  68. #if defined( VALVE_CALLBACK_PACK_SMALL )
  69. #pragma pack( push, 4 )
  70. #elif defined( VALVE_CALLBACK_PACK_LARGE )
  71. #pragma pack( push, 8 )
  72. #else
  73. #error isteamclient.h must be included
  74. #endif
  75. //-----------------------------------------------------------------------------
  76. // Purpose: Screenshot successfully written or otherwise added to the library
  77. // and can now be tagged
  78. //-----------------------------------------------------------------------------
  79. struct ScreenshotReady_t
  80. {
  81. enum { k_iCallback = k_iSteamScreenshotsCallbacks + 1 };
  82. ScreenshotHandle m_hLocal;
  83. EResult m_eResult;
  84. };
  85. //-----------------------------------------------------------------------------
  86. // Purpose: Screenshot has been requested by the user. Only sent if
  87. // HookScreenshots() has been called, in which case Steam will not take
  88. // the screenshot itself.
  89. //-----------------------------------------------------------------------------
  90. struct ScreenshotRequested_t
  91. {
  92. enum { k_iCallback = k_iSteamScreenshotsCallbacks + 2 };
  93. };
  94. #pragma pack( pop )
  95. #endif // ISTEAMSCREENSHOTS_H