Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
3.9 KiB

  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 int k_cubUFSTagTypeMax = 255;
  14. const int k_cubUFSTagValueMax = 255;
  15. // Required with of a thumbnail provided to AddScreenshotToLibrary. If you do not provide a thumbnail
  16. // one will be generated.
  17. const int k_ScreenshotThumbWidth = 200;
  18. // Handle is valid for the lifetime of your process and no longer
  19. typedef uint32 ScreenshotHandle;
  20. #define INVALID_SCREENSHOT_HANDLE 0
  21. //-----------------------------------------------------------------------------
  22. // Purpose: Functions for adding screenshots to the user's screenshot library
  23. //-----------------------------------------------------------------------------
  24. class ISteamScreenshots
  25. {
  26. public:
  27. // Writes a screenshot to the user's screenshot library given the raw image data, which must be in RGB format.
  28. // The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
  29. virtual ScreenshotHandle WriteScreenshot( void *pubRGB, uint32 cubRGB, int nWidth, int nHeight ) = 0;
  30. // 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
  31. // 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.
  32. // The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
  33. // JPEG, TGA, and PNG formats are supported.
  34. virtual ScreenshotHandle AddScreenshotToLibrary( const char *pchFilename, const char *pchThumbnailFilename, int nWidth, int nHeight ) = 0;
  35. // 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.
  36. virtual void TriggerScreenshot() = 0;
  37. // Toggles whether the overlay handles screenshots when the user presses the screenshot hotkey, or the game handles them. If the game is hooking screenshots,
  38. // then the ScreenshotRequested_t callback will be sent if the user presses the hotkey, and the game is expected to call WriteScreenshot or AddScreenshotToLibrary
  39. // in response.
  40. virtual void HookScreenshots( bool bHook ) = 0;
  41. // Sets metadata about a screenshot's location (for example, the name of the map)
  42. virtual bool SetLocation( ScreenshotHandle hScreenshot, const char *pchLocation ) = 0;
  43. // Tags a user as being visible in the screenshot
  44. virtual bool TagUser( ScreenshotHandle hScreenshot, CSteamID steamID ) = 0;
  45. };
  46. #define STEAMSCREENSHOTS_INTERFACE_VERSION "STEAMSCREENSHOTS_INTERFACE_VERSION001"
  47. // callbacks
  48. #pragma pack( push, 8 )
  49. //-----------------------------------------------------------------------------
  50. // Purpose: Screenshot successfully written or otherwise added to the library
  51. // and can now be tagged
  52. //-----------------------------------------------------------------------------
  53. struct ScreenshotReady_t
  54. {
  55. enum { k_iCallback = k_iSteamScreenshotsCallbacks + 1 };
  56. ScreenshotHandle m_hLocal;
  57. EResult m_eResult;
  58. };
  59. //-----------------------------------------------------------------------------
  60. // Purpose: Screenshot has been requested by the user. Only sent if
  61. // HookScreenshots() has been called, in which case Steam will not take
  62. // the screenshot itself.
  63. //-----------------------------------------------------------------------------
  64. struct ScreenshotRequested_t
  65. {
  66. enum { k_iCallback = k_iSteamScreenshotsCallbacks + 2 };
  67. };
  68. #pragma pack( pop )
  69. #endif // ISTEAMSCREENSHOTS_H