add support for joystick; move some mono dlls to new path
This commit is contained in:
@ -8,9 +8,9 @@ namespace Prism
|
||||
{
|
||||
Normal = 0,
|
||||
Hidden = 1,
|
||||
Locked = 2,
|
||||
Locked = 2,
|
||||
}
|
||||
|
||||
|
||||
public enum MouseButton
|
||||
{
|
||||
Button0 = 0,
|
||||
@ -23,7 +23,36 @@ namespace Prism
|
||||
Right = Button1,
|
||||
Middle = Button2
|
||||
}
|
||||
|
||||
|
||||
public enum GamepadButton
|
||||
{
|
||||
A = 0,
|
||||
B = 1,
|
||||
X = 2,
|
||||
Y = 3,
|
||||
LeftBumper = 4,
|
||||
RightBumper = 5,
|
||||
Back = 6,
|
||||
Start = 7,
|
||||
Guide = 8,
|
||||
LeftThumb = 9,
|
||||
RightThumb = 10,
|
||||
DpadUp = 11,
|
||||
DpadRight = 12,
|
||||
DpadDown = 13,
|
||||
DpadLeft = 14
|
||||
}
|
||||
|
||||
public enum GamepadAxis
|
||||
{
|
||||
LeftX = 0,
|
||||
LeftY = 1,
|
||||
RightX = 2,
|
||||
RightY = 3,
|
||||
LeftTrigger = 4,
|
||||
RightTrigger = 5
|
||||
}
|
||||
|
||||
|
||||
public static bool IsKeyPressed(KeyCode keycode)
|
||||
{
|
||||
@ -44,7 +73,45 @@ namespace Prism
|
||||
public static void SetCursorMode(CursorMode mode) => SetCursorMode_Native(mode);
|
||||
public static CursorMode GetCursorMode() => GetCursorMode_Native();
|
||||
|
||||
|
||||
public static bool IsGamepadConnected(int joystickID)
|
||||
{
|
||||
return IsGamepadConnected_Native(joystickID);
|
||||
}
|
||||
|
||||
public static string GetGamepadName(int joystickID)
|
||||
{
|
||||
return GetGamepadName_Native(joystickID);
|
||||
}
|
||||
|
||||
public static bool IsGamepad(int joystickID)
|
||||
{
|
||||
return IsGamepad_Native(joystickID);
|
||||
}
|
||||
|
||||
public static bool IsGamepadButtonPressed(int joystickID, GamepadButton button)
|
||||
{
|
||||
return IsGamepadButtonPressed_Native(joystickID, (ushort)button);
|
||||
}
|
||||
|
||||
public static bool IsGamepadButtonReleased(int joystickID, GamepadButton button)
|
||||
{
|
||||
return IsGamepadButtonReleased_Native(joystickID, (ushort)button);
|
||||
}
|
||||
|
||||
public static float GetGamepadAxis(int joystickID, GamepadAxis axis)
|
||||
{
|
||||
return GetGamepadAxis_Native(joystickID, (byte)axis);
|
||||
}
|
||||
|
||||
public static float GetGamepadLeftX(int joystickID) => GetGamepadLeftX_Native(joystickID);
|
||||
public static float GetGamepadLeftY(int joystickID) => GetGamepadLeftY_Native(joystickID);
|
||||
public static float GetGamepadRightX(int joystickID) => GetGamepadRightX_Native(joystickID);
|
||||
public static float GetGamepadRightY(int joystickID) => GetGamepadRightY_Native(joystickID);
|
||||
public static float GetGamepadLeftTrigger(int joystickID) => GetGamepadLeftTrigger_Native(joystickID);
|
||||
public static float GetGamepadRightTrigger(int joystickID) => GetGamepadRightTrigger_Native(joystickID);
|
||||
|
||||
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern bool IsKeyPressed_Native(KeyCode keycode);
|
||||
@ -60,5 +127,41 @@ namespace Prism
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern CursorMode GetCursorMode_Native();
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern bool IsGamepadConnected_Native(int joystickID);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern string GetGamepadName_Native(int joystickID);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern bool IsGamepad_Native(int joystickID);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern bool IsGamepadButtonPressed_Native(int joystickID, ushort button);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern bool IsGamepadButtonReleased_Native(int joystickID, ushort button);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern float GetGamepadAxis_Native(int joystickID, byte axis);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern float GetGamepadLeftX_Native(int joystickID);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern float GetGamepadLeftY_Native(int joystickID);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern float GetGamepadRightX_Native(int joystickID);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern float GetGamepadRightY_Native(int joystickID);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern float GetGamepadLeftTrigger_Native(int joystickID);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern float GetGamepadRightTrigger_Native(int joystickID);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user