Button.cs
1 using System; 2 3 namespace Ryujinx.Input 4 { 5 public readonly struct Button 6 { 7 public readonly ButtonType Type; 8 private readonly uint _rawValue; 9 10 public Button(Key key) 11 { 12 Type = ButtonType.Key; 13 _rawValue = (uint)key; 14 } 15 16 public Button(GamepadButtonInputId gamepad) 17 { 18 Type = ButtonType.GamepadButtonInputId; 19 _rawValue = (uint)gamepad; 20 } 21 22 public Button(StickInputId stick) 23 { 24 Type = ButtonType.StickId; 25 _rawValue = (uint)stick; 26 } 27 28 public T AsHidType<T>() where T : Enum 29 { 30 return (T)Enum.ToObject(typeof(T), _rawValue); 31 } 32 } 33 }