mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-29 06:28:25 +01:00
first
This commit is contained in:
parent
bd62d51ec9
commit
b578433e37
1 changed files with 784842 additions and 0 deletions
35
Brutal.Sdl/Manual/Libraries/Sdl.Gamepad.cs
Normal file
35
Brutal.Sdl/Manual/Libraries/Sdl.Gamepad.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue