isteamscreenshots.cs (5874B)
1 // This file is provided under The MIT License as part of Steamworks.NET. 2 // Copyright (c) 2013-2019 Riley Labrecque 3 // Please see the included LICENSE.txt for additional information. 4 5 // This file is automatically generated. 6 // Changes to this file will be reverted when you update Steamworks.NET 7 8 #if UNITY_ANDROID || UNITY_IOS || UNITY_TIZEN || UNITY_TVOS || UNITY_WEBGL || UNITY_WSA || UNITY_PS4 || UNITY_WII || UNITY_XBOXONE || UNITY_SWITCH 9 #define DISABLESTEAMWORKS 10 #endif 11 12 #if !DISABLESTEAMWORKS 13 14 using System.Runtime.InteropServices; 15 using IntPtr = System.IntPtr; 16 17 namespace Steamworks { 18 public static class SteamScreenshots { 19 /// <summary> 20 /// <para> Writes a screenshot to the user's screenshot library given the raw image data, which must be in RGB format.</para> 21 /// <para> The return value is a handle that is valid for the duration of the game process and can be used to apply tags.</para> 22 /// </summary> 23 public static ScreenshotHandle WriteScreenshot(byte[] pubRGB, uint cubRGB, int nWidth, int nHeight) { 24 InteropHelp.TestIfAvailableClient(); 25 return (ScreenshotHandle)NativeMethods.ISteamScreenshots_WriteScreenshot(CSteamAPIContext.GetSteamScreenshots(), pubRGB, cubRGB, nWidth, nHeight); 26 } 27 28 /// <summary> 29 /// <para> 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</para> 30 /// <para> 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.</para> 31 /// <para> The return value is a handle that is valid for the duration of the game process and can be used to apply tags.</para> 32 /// <para> JPEG, TGA, and PNG formats are supported.</para> 33 /// </summary> 34 public static ScreenshotHandle AddScreenshotToLibrary(string pchFilename, string pchThumbnailFilename, int nWidth, int nHeight) { 35 InteropHelp.TestIfAvailableClient(); 36 using (var pchFilename2 = new InteropHelp.UTF8StringHandle(pchFilename)) 37 using (var pchThumbnailFilename2 = new InteropHelp.UTF8StringHandle(pchThumbnailFilename)) { 38 return (ScreenshotHandle)NativeMethods.ISteamScreenshots_AddScreenshotToLibrary(CSteamAPIContext.GetSteamScreenshots(), pchFilename2, pchThumbnailFilename2, nWidth, nHeight); 39 } 40 } 41 42 /// <summary> 43 /// <para> 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.</para> 44 /// </summary> 45 public static void TriggerScreenshot() { 46 InteropHelp.TestIfAvailableClient(); 47 NativeMethods.ISteamScreenshots_TriggerScreenshot(CSteamAPIContext.GetSteamScreenshots()); 48 } 49 50 /// <summary> 51 /// <para> Toggles whether the overlay handles screenshots when the user presses the screenshot hotkey, or the game handles them. If the game is hooking screenshots,</para> 52 /// <para> then the ScreenshotRequested_t callback will be sent if the user presses the hotkey, and the game is expected to call WriteScreenshot or AddScreenshotToLibrary</para> 53 /// <para> in response.</para> 54 /// </summary> 55 public static void HookScreenshots(bool bHook) { 56 InteropHelp.TestIfAvailableClient(); 57 NativeMethods.ISteamScreenshots_HookScreenshots(CSteamAPIContext.GetSteamScreenshots(), bHook); 58 } 59 60 /// <summary> 61 /// <para> Sets metadata about a screenshot's location (for example, the name of the map)</para> 62 /// </summary> 63 public static bool SetLocation(ScreenshotHandle hScreenshot, string pchLocation) { 64 InteropHelp.TestIfAvailableClient(); 65 using (var pchLocation2 = new InteropHelp.UTF8StringHandle(pchLocation)) { 66 return NativeMethods.ISteamScreenshots_SetLocation(CSteamAPIContext.GetSteamScreenshots(), hScreenshot, pchLocation2); 67 } 68 } 69 70 /// <summary> 71 /// <para> Tags a user as being visible in the screenshot</para> 72 /// </summary> 73 public static bool TagUser(ScreenshotHandle hScreenshot, CSteamID steamID) { 74 InteropHelp.TestIfAvailableClient(); 75 return NativeMethods.ISteamScreenshots_TagUser(CSteamAPIContext.GetSteamScreenshots(), hScreenshot, steamID); 76 } 77 78 /// <summary> 79 /// <para> Tags a published file as being visible in the screenshot</para> 80 /// </summary> 81 public static bool TagPublishedFile(ScreenshotHandle hScreenshot, PublishedFileId_t unPublishedFileID) { 82 InteropHelp.TestIfAvailableClient(); 83 return NativeMethods.ISteamScreenshots_TagPublishedFile(CSteamAPIContext.GetSteamScreenshots(), hScreenshot, unPublishedFileID); 84 } 85 86 /// <summary> 87 /// <para> Returns true if the app has hooked the screenshot</para> 88 /// </summary> 89 public static bool IsScreenshotsHooked() { 90 InteropHelp.TestIfAvailableClient(); 91 return NativeMethods.ISteamScreenshots_IsScreenshotsHooked(CSteamAPIContext.GetSteamScreenshots()); 92 } 93 94 /// <summary> 95 /// <para> Adds a VR screenshot to the user's screenshot library from disk in the supported type.</para> 96 /// <para> pchFilename should be the normal 2D image used in the library view</para> 97 /// <para> pchVRFilename should contain the image that matches the correct type</para> 98 /// <para> The return value is a handle that is valid for the duration of the game process and can be used to apply tags.</para> 99 /// <para> JPEG, TGA, and PNG formats are supported.</para> 100 /// </summary> 101 public static ScreenshotHandle AddVRScreenshotToLibrary(EVRScreenshotType eType, string pchFilename, string pchVRFilename) { 102 InteropHelp.TestIfAvailableClient(); 103 using (var pchFilename2 = new InteropHelp.UTF8StringHandle(pchFilename)) 104 using (var pchVRFilename2 = new InteropHelp.UTF8StringHandle(pchVRFilename)) { 105 return (ScreenshotHandle)NativeMethods.ISteamScreenshots_AddVRScreenshotToLibrary(CSteamAPIContext.GetSteamScreenshots(), eType, pchFilename2, pchVRFilename2); 106 } 107 } 108 } 109 } 110 111 #endif // !DISABLESTEAMWORKS