Skip to content

InputPrompts

namespace Griff.Runtime;
public static class InputPrompts

Short names for keys and buttons, the way a player reads them on screen: “Space”, “Esc”, “Left Click”, “A”, “RB”.

public static string AllFor(IInput input, string action)

Every key and mouse button bound to action, or every gamepad button while a gamepad is being played with, joined with “ / “: “Esc / Right Click”. What “{DropTool:all}” shows. Follows the player’s rebinding.

public static string Fill(IInput input, string text, string? listening = null)

text with every action’s name in braces swapped for its prompt: “Press {Jump}” becomes “Press Space”. “{DropTool:all}” shows every binding on the device in use (“Esc / Right Click”, see AllFor), and “{PanUp:1}” the one in a slot (see SlotFor). Braces around anything else (not an action) are left alone. listening is an action shown as Listening instead, written the same way: “Jump” for all of its prompts, “Jump:1” for its slot 1 and those that show it whole.

public static string Name(InputBinding binding)

The name to show for binding, e.g. “Space”, “Left Click” or “A”.

public static string Name(Key key)
public static string Name(GamepadButton button)
public static string PromptFor(IInput input, string action)

What to show for action right now: its first gamepad button while a gamepad is being played with, else its first key or mouse button, e.g. “Press “ + Input.PromptFor(“Jump”). Follows the player’s rebinding.

public static string SlotFor(IInput input, string action, int slot)

The binding in slot of action on the device being played with: 0 is its first key or mouse button (or gamepad button), 1 its second, and so on, as a Rebind button’s BindingSlot counts them; Unbound past the last. What “{PanUp:1}” shows.

public const string Listening

What’s shown for an action while a Rebind button waits for the player to press something.

public const string Unbound

What’s shown for an action with nothing bound to it on the device being used.