mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-10 04:39:11 +00:00
r e a d o n l y
This commit is contained in:
parent
6846f23c62
commit
fffe67b5c5
1 changed files with 15 additions and 15 deletions
|
@ -4,45 +4,45 @@ namespace Ryujinx.Input
|
|||
{
|
||||
public enum ButtonValueType { Key, GamepadButtonInputId, StickId }
|
||||
|
||||
public struct ButtonValue
|
||||
public readonly struct ButtonValue
|
||||
{
|
||||
private ButtonValueType Type;
|
||||
private uint RawValue;
|
||||
private readonly ButtonValueType _type;
|
||||
private readonly uint _rawValue;
|
||||
|
||||
public ButtonValue(Key key)
|
||||
{
|
||||
Type = ButtonValueType.Key;
|
||||
RawValue = (uint)key;
|
||||
_type = ButtonValueType.Key;
|
||||
_rawValue = (uint)key;
|
||||
}
|
||||
|
||||
public ButtonValue(GamepadButtonInputId gamepad)
|
||||
{
|
||||
Type = ButtonValueType.GamepadButtonInputId;
|
||||
RawValue = (uint)gamepad;
|
||||
_type = ButtonValueType.GamepadButtonInputId;
|
||||
_rawValue = (uint)gamepad;
|
||||
}
|
||||
|
||||
public ButtonValue(StickInputId stick)
|
||||
{
|
||||
Type = ButtonValueType.StickId;
|
||||
RawValue = (uint)stick;
|
||||
_type = ButtonValueType.StickId;
|
||||
_rawValue = (uint)stick;
|
||||
}
|
||||
|
||||
public Common.Configuration.Hid.Key AsKey()
|
||||
{
|
||||
Debug.Assert(Type == ButtonValueType.Key);
|
||||
return (Common.Configuration.Hid.Key)RawValue;
|
||||
Debug.Assert(_type == ButtonValueType.Key);
|
||||
return (Common.Configuration.Hid.Key)_rawValue;
|
||||
}
|
||||
|
||||
public Common.Configuration.Hid.Controller.GamepadInputId AsGamepadButtonInputId()
|
||||
{
|
||||
Debug.Assert(Type == ButtonValueType.GamepadButtonInputId);
|
||||
return (Common.Configuration.Hid.Controller.GamepadInputId)RawValue;
|
||||
Debug.Assert(_type == ButtonValueType.GamepadButtonInputId);
|
||||
return (Common.Configuration.Hid.Controller.GamepadInputId)_rawValue;
|
||||
}
|
||||
|
||||
public Common.Configuration.Hid.Controller.StickInputId AsGamepadStickId()
|
||||
{
|
||||
Debug.Assert(Type == ButtonValueType.StickId);
|
||||
return (Common.Configuration.Hid.Controller.StickInputId)RawValue;
|
||||
Debug.Assert(_type == ButtonValueType.StickId);
|
||||
return (Common.Configuration.Hid.Controller.StickInputId)_rawValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue