brutal/Brutal.Sdl/Manual/Libraries/Sdl.Gamepad.cs
Rian Drake b578433e37 first
2026-10-15 17:10:50 +13:00

35 lines
1,003 B
C#

namespace Brutal.SdlApi;
public static unsafe partial class Sdl
{
public static unsafe partial class Gamepad
{
public static bool GetGamepadTouchpadFinger(
SdlGamepad gamepad,
int touchpad,
int finger,
out bool down,
out float x,
out float y,
out float pressure
)
{
// SDL leaves the out-pointers untouched on failure, so pre-zero them.
byte downByte = 0;
bool result;
x = default;
y = default;
pressure = default;
fixed (float* xPtr = &x)
fixed (float* yPtr = &y)
fixed (float* pressurePtr = &pressure)
{
result =
PInvoke.GetGamepadTouchpadFinger(gamepad, touchpad, finger, &downByte, xPtr, yPtr, pressurePtr)
!= 0;
}
down = downByte != 0;
return result;
}
}
}