mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-10 12:49:13 +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 enum ButtonValueType { Key, GamepadButtonInputId, StickId }
|
||||||
|
|
||||||
public struct ButtonValue
|
public readonly struct ButtonValue
|
||||||
{
|
{
|
||||||
private ButtonValueType Type;
|
private readonly ButtonValueType _type;
|
||||||
private uint RawValue;
|
private readonly uint _rawValue;
|
||||||
|
|
||||||
public ButtonValue(Key key)
|
public ButtonValue(Key key)
|
||||||
{
|
{
|
||||||
Type = ButtonValueType.Key;
|
_type = ButtonValueType.Key;
|
||||||
RawValue = (uint)key;
|
_rawValue = (uint)key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ButtonValue(GamepadButtonInputId gamepad)
|
public ButtonValue(GamepadButtonInputId gamepad)
|
||||||
{
|
{
|
||||||
Type = ButtonValueType.GamepadButtonInputId;
|
_type = ButtonValueType.GamepadButtonInputId;
|
||||||
RawValue = (uint)gamepad;
|
_rawValue = (uint)gamepad;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ButtonValue(StickInputId stick)
|
public ButtonValue(StickInputId stick)
|
||||||
{
|
{
|
||||||
Type = ButtonValueType.StickId;
|
_type = ButtonValueType.StickId;
|
||||||
RawValue = (uint)stick;
|
_rawValue = (uint)stick;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Common.Configuration.Hid.Key AsKey()
|
public Common.Configuration.Hid.Key AsKey()
|
||||||
{
|
{
|
||||||
Debug.Assert(Type == ButtonValueType.Key);
|
Debug.Assert(_type == ButtonValueType.Key);
|
||||||
return (Common.Configuration.Hid.Key)RawValue;
|
return (Common.Configuration.Hid.Key)_rawValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Common.Configuration.Hid.Controller.GamepadInputId AsGamepadButtonInputId()
|
public Common.Configuration.Hid.Controller.GamepadInputId AsGamepadButtonInputId()
|
||||||
{
|
{
|
||||||
Debug.Assert(Type == ButtonValueType.GamepadButtonInputId);
|
Debug.Assert(_type == ButtonValueType.GamepadButtonInputId);
|
||||||
return (Common.Configuration.Hid.Controller.GamepadInputId)RawValue;
|
return (Common.Configuration.Hid.Controller.GamepadInputId)_rawValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Common.Configuration.Hid.Controller.StickInputId AsGamepadStickId()
|
public Common.Configuration.Hid.Controller.StickInputId AsGamepadStickId()
|
||||||
{
|
{
|
||||||
Debug.Assert(Type == ButtonValueType.StickId);
|
Debug.Assert(_type == ButtonValueType.StickId);
|
||||||
return (Common.Configuration.Hid.Controller.StickInputId)RawValue;
|
return (Common.Configuration.Hid.Controller.StickInputId)_rawValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue