mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-12 14:48:02 +03:00
Added Screenshots.Write( rgbData, width, height )
This commit is contained in:
parent
72c5427be6
commit
ba32817183
@ -35,5 +35,36 @@ namespace Facepunch.Steamworks
|
|||||||
client.native.screenshots.TriggerScreenshot();
|
client.native.screenshots.TriggerScreenshot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public unsafe void Write( byte[] rgbData, int width, int height )
|
||||||
|
{
|
||||||
|
if ( rgbData == null )
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException( nameof(rgbData) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( width < 1 )
|
||||||
|
{
|
||||||
|
throw new ArgumentOutOfRangeException( nameof(width), width,
|
||||||
|
$"Expected {nameof(width)} to be at least 1." );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( height < 1 )
|
||||||
|
{
|
||||||
|
throw new ArgumentOutOfRangeException( nameof(height), height,
|
||||||
|
$"Expected {nameof(height)} to be at least 1." );
|
||||||
|
}
|
||||||
|
|
||||||
|
var size = width * height * 3;
|
||||||
|
if ( rgbData.Length < size )
|
||||||
|
{
|
||||||
|
throw new ArgumentException( nameof(rgbData),
|
||||||
|
$"Expected {nameof(rgbData)} to contain at least {size} elements (actual size: {rgbData.Length})." );
|
||||||
|
}
|
||||||
|
|
||||||
|
fixed ( byte* ptr = rgbData )
|
||||||
|
{
|
||||||
|
client.native.screenshots.WriteScreenshot( (IntPtr) ptr, (uint) rgbData.Length, width, height );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user