LocalPlayerInput
namespace Griff.Runtime;
public sealed class LocalPlayerInput : IInputOne player’s share of this machine’s controls (see LocalPlayers): the keys of their side of the keyboard (or all of it, with the mouse), and their own controller. The actions are the game’s, read on those keys and that controller only: on the left keys Punch is F and Kick G, on the right K and L, and the rest are the action’s own keys on that side of the keyboard.
Properties
Section titled “Properties”Actions
Section titled “Actions”public IReadOnlyCollection<string> Actions { get; }AnyPressed
Section titled “AnyPressed”public InputBinding? AnyPressed { get; }Cursor
Section titled “Cursor”public MouseCursor Cursor { get; set; }Horizontal
Section titled “Horizontal”public float Horizontal { get; }IsGamepadConnected
Section titled “IsGamepadConnected”public bool IsGamepadConnected { get; }IsMouseInView
Section titled “IsMouseInView”public bool IsMouseInView { get; }IsMouseLocked
Section titled “IsMouseLocked”public bool IsMouseLocked { get; }public KeySet Keys { get; }Which keys it has.
LeftKeys
Section titled “LeftKeys”public static IReadOnlyDictionary<string, Key[]> LeftKeys { get; }The keys the actions have on the left side of the keyboard, where they aren’t simply their own keys on that side: WASD moves, F and G are the first buttons (Punch and Kick, Fire and Attack).
LeftStick
Section titled “LeftStick”public Vector2 LeftStick { get; }LeftTrigger
Section titled “LeftTrigger”public float LeftTrigger { get; }MouseDelta
Section titled “MouseDelta”public Vector2 MouseDelta { get; }MouseOnScreen
Section titled “MouseOnScreen”public Vector2? MouseOnScreen { get; }MouseWorld
Section titled “MouseWorld”public Vector2 MouseWorld { get; }public Vector2 Move { get; }public int Pad { get; }The platform’s number of its controller, or -1 for none.
RightKeys
Section titled “RightKeys”public static IReadOnlyDictionary<string, Key[]> RightKeys { get; }The keys the actions have on the right side of the keyboard: the arrows move, K and L (or the number pad’s 1 and 2) are the first buttons.
RightStick
Section titled “RightStick”public Vector2 RightStick { get; }RightTrigger
Section titled “RightTrigger”public float RightTrigger { get; }Scroll
Section titled “Scroll”public float Scroll { get; }TypedText
Section titled “TypedText”public string TypedText { get; }UsingGamepad
Section titled “UsingGamepad”public bool UsingGamepad { get; }Vertical
Section titled “Vertical”public float Vertical { get; }WantsMouseLock
Section titled “WantsMouseLock”public bool WantsMouseLock { get; set; }Methods
Section titled “Methods”AimFrom
Section titled “AimFrom”public Vector2 AimFrom(Vector2 origin)AimFrom
Section titled “AimFrom”public Vector2 AimFrom(Vector3 origin)public void Bind(string action, params InputBinding[] bindings)BindingsOf
Section titled “BindingsOf”public IReadOnlyList<InputBinding> BindingsOf(string action)The keys and buttons that are action for this player: their side’s keys, and the controller’s buttons.
IsDown
Section titled “IsDown”public bool IsDown(string action)IsDown
Section titled “IsDown”public bool IsDown(Key key)IsDown
Section titled “IsDown”public bool IsDown(MouseButton button)IsDown
Section titled “IsDown”public bool IsDown(GamepadButton button)KeysOf
Section titled “KeysOf”public IReadOnlyList<Key> KeysOf(string action, KeySet side)The keys action has on side of the keyboard (all of them for All).
OnLeft
Section titled “OnLeft”public static bool OnLeft(Key key)True if key is on the left side of the keyboard (as the left keys’ player has it).
Rebind
Section titled “Rebind”public void Rebind(string action, params InputBinding[] bindings)ResetBindings
Section titled “ResetBindings”public void ResetBindings(string? action = null)Rumble
Section titled “Rumble”public void Rumble(float strength = 0.5f, float seconds = 0.2f)TypeInto
Section titled “TypeInto”public string TypeInto(string text, int maxLength = 2147483647)WasPressed
Section titled “WasPressed”public bool WasPressed(string action)WasPressed
Section titled “WasPressed”public bool WasPressed(Key key)WasPressed
Section titled “WasPressed”public bool WasPressed(MouseButton button)WasPressed
Section titled “WasPressed”public bool WasPressed(GamepadButton button)WasPressed
Section titled “WasPressed”public bool WasPressed(string action, float buffer)WasReleased
Section titled “WasReleased”public bool WasReleased(string action)WasReleased
Section titled “WasReleased”public bool WasReleased(Key key)WasReleased
Section titled “WasReleased”public bool WasReleased(MouseButton button)WasReleased
Section titled “WasReleased”public bool WasReleased(GamepadButton button)