mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 13:08:24 +01:00
35 lines
1,003 B
C#
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;
|
|
}
|
|
}
|
|
}
|