Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl/llms.txt

Use this file to discover all available pages before exploring further.

Prowl’s input system is layered around a stack of IInputHandler implementations. The Input static class simply delegates every query to the handler on top of the stack — Input.Current. This design lets the editor, the game viewport, and UI subsystems push their own handlers to intercept or block input without affecting each other. The default game handler is DefaultInputHandler, which bridges Veldrid’s raw input events into Prowl’s Key and MouseButton enums. All keyboard and mouse state queries follow a three-state model: held (GetKey), pressed this frame (GetKeyDown), and released this frame (GetKeyUp).

Handler Stack

Handlers
Stack<IInputHandler>
The full stack of active input handlers. The topmost handler receives all queries.
Current
IInputHandler
Returns Handlers.Peek() — the active (topmost) handler.

PushHandler

public static void PushHandler(IInputHandler handler)
Pushes a new handler onto the stack. All subsequent Input.* calls will be routed to this handler.
handler
IInputHandler
The handler to activate.

PopHandler

public static void PopHandler()
Removes the topmost handler, restoring the previous one.
// Temporarily capture input for a UI modal
var uiHandler = new UIInputHandler();
Input.PushHandler(uiHandler);
// ... modal is shown ...
Input.PopHandler();

Keyboard

GetKey

public static bool GetKey(Key key)
Returns true every frame the key is held down.

GetKeyDown

public static bool GetKeyDown(Key key)
Returns true only on the frame the key was first pressed.

GetKeyUp

public static bool GetKeyUp(Key key)
Returns true only on the frame the key was released.
// Hold to sprint
if (Input.GetKey(Key.LeftShift))
    speed *= 2f;

// Toggle menu on press
if (Input.GetKeyDown(Key.Escape))
    ToggleMenu();

Additional keyboard properties

InputString
IReadOnlyList<char>
Characters typed this frame, in order. Useful for text-input fields.

Mouse Buttons

GetMouseButton

public static bool GetMouseButton(MouseButton button)
Returns true every frame the button is held.

GetMouseButtonDown

public static bool GetMouseButtonDown(MouseButton button)
Returns true only on the frame the button was first pressed.

GetMouseButtonUp

public static bool GetMouseButtonUp(MouseButton button)
Returns true only on the frame the button was released.
if (Input.GetMouseButtonDown(MouseButton.Left))
    FireWeapon();

Mouse Position and Movement

MousePosition
Vector2Int
Gets or sets the cursor position in screen pixels (origin at top-left).
PrevMousePosition
Vector2Int
The cursor position at the end of the previous frame.
MouseDelta
Vector2
Raw cursor movement in pixels since the last frame. Does not depend on cursor position when CursorLocked is true.
MouseWheelDelta
float
Scroll-wheel movement this frame. Positive values indicate scrolling up/towards the user.
// First-person look
Vector2 look = Input.MouseDelta * sensitivity * (float)Time.deltaTime;
transform.Rotate(new Vector3(-look.y, look.x, 0));

Cursor Control

CursorVisible
bool
Gets or sets cursor visibility. When false the OS cursor is hidden.
CursorLocked
bool
Gets or sets cursor lock state. When true the cursor is confined to the window and MouseDelta reports raw device movement.
// Lock cursor for FPS-style controls
Input.CursorVisible = false;
Input.CursorLocked  = true;

Clipboard

Clipboard
string
Gets or sets the system clipboard text contents. Delegates to the current handler’s clipboard implementation.

Events

public static event Action<Key, bool> OnKeyEvent
Fires on key press (bool = true) and release (bool = false).
public static event Action<MouseButton, double, double, bool, bool> OnMouseEvent
Fires on mouse button events. Parameters: (button, x, y, pressed, doubleClick).

IInputHandler Interface

Implement IInputHandler to create a custom input source (e.g., gamepad, virtual keyboard, remote input).
public interface IInputHandler
{
    string Clipboard { get; set; }
    bool IsAnyKeyDown { get; }
    IReadOnlyList<char> InputString { get; set; }

    Vector2    MouseDelta         { get; }
    Vector2Int MousePosition      { get; set; }
    float      MouseWheelDelta    { get; }
    Vector2Int PrevMousePosition  { get; }

    bool CursorVisible { get; set; }
    bool CursorLocked  { get; set; }

    event Action<Key, bool> OnKeyEvent;
    event Action<MouseButton, double, double, bool, bool> OnMouseEvent;

    bool GetKey(Key key);
    bool GetKeyDown(Key key);
    bool GetKeyUp(Key key);
    bool GetMouseButton(MouseButton button);
    bool GetMouseButtonDown(MouseButton button);
    bool GetMouseButtonUp(MouseButton button);
}
IsAnyKeyDown
bool
true if any key is currently pressed. Provided by the active IInputHandler; not directly exposed on the Input static class.

Key Enum

Key maps directly to Veldrid’s Key enum, covering the full SDL2 keycode set. Common values:
Key.A through Key.Z
Key.Num0Key.Num9, Key.Keypad0Key.Keypad9
Key.F1Key.F24
ValueDescription
Key.LeftShiftLeft Shift
Key.RightShiftRight Shift
Key.LeftControlLeft Control
Key.RightControlRight Control
Key.LeftAltLeft Alt
Key.RightAltRight Alt
Key.LeftGuiLeft Super / Windows key
Key.RightGuiRight Super / Windows key
Key.CapsLockCaps Lock

MouseButton Enum

ValueDescription
MouseButton.LeftPrimary mouse button
MouseButton.RightSecondary mouse button
MouseButton.MiddleMiddle / scroll-wheel button
MouseButton.Button1Button9Extra mouse buttons (side buttons, etc.)
MouseButton.UnknownUnrecognised button (-1)

Build docs developers (and LLMs) love