IInputContext Interface
Provides input handling for keyboard, mouse, and gamepad.
public interface IInputContext : System.IDisposable
Derived
↳ HeadlessInputContext
↳ InputContext
Implements System.IDisposable
| Properties | |
|---|---|
| ConnectedGamepadCount | Gets the number of gamepad slots currently occupied by connected gamepads. Useful for iterating all connected gamepads in multiplayer lobbies. |
| GamepadDeadzone | Gets or sets the radial deadzone threshold for gamepad sticks (0.0 to 1.0). Values within the deadzone are reported as zero. The remaining range is rescaled to 0–1 so that movement begins smoothly at the deadzone edge. Default is 0.15. |
| IsCursorVisible | Gets or sets whether the mouse cursor is visible. |
| IsRelativeMouseMode | Gets or sets whether relative mouse mode is enabled. When enabled, the cursor is hidden, the mouse is captured, and only MouseDelta is meaningful (position is not updated). Useful for first-person cameras and drag operations. |
| IsTextInputActive | Gets whether text input mode is active. |
| MouseDelta | Gets the mouse movement delta since last frame. |
| MousePosition | Gets the current mouse position in window coordinates. |
| ScrollWheelDelta | Gets the vertical mouse scroll wheel delta. |
| ScrollWheelDeltaX | Gets the horizontal mouse scroll wheel delta. |
| Methods | |
|---|---|
| GetGamepadAxis(GamepadAxis, int) | Gets the value of a gamepad axis (−1.0 to 1.0 for sticks, 0.0 to 1.0 for triggers). Returns the raw axis value without deadzone applied. |
| GetGamepadLeftStick(int) | Gets the left stick position as a vector (-1 to 1 for each axis) with radial deadzone applied. |
| GetGamepadRightStick(int) | Gets the right stick position as a vector (-1 to 1 for each axis) with radial deadzone applied. |
| GetGamepadTrigger(GamepadAxis, int) | Gets the value of a gamepad trigger (0.0 to 1.0). Only Brine2D.Input.GamepadAxis.LeftTrigger and Brine2D.Input.GamepadAxis.RightTrigger are valid. |
| GetTextInput() | Gets the text that was input this frame (from SDL_EVENT_TEXT_INPUT). This properly handles Unicode, IME, and keyboard layouts. |
| IsAnyGamepadButtonPressed(int) | Returns true if any gamepad button was pressed this frame on the specified gamepad. Useful for "press any button to continue" screens. |
| IsAnyGamepadButtonPressedOnAny(int) | Returns true if any gamepad button was pressed this frame on any connected gamepad. Useful for multiplayer "press any button to join" lobbies. The gamepadIndex output indicates which gamepad pressed a button, or -1 if none did. |
| IsAnyKeyPressed() | Returns true if any key was pressed this frame. Useful for "press any key to continue" screens. |
| IsAnyMouseButtonPressed() | Returns true if any mouse button was pressed this frame. Useful for "press any button to continue" screens. |
| IsBackspacePressed() | Returns true if backspace was pressed this frame, including key repeats. Useful for text editing; works regardless of whether text input mode is active. Note: unlike IsKeyPressed(Key), this fires on held-key repeats to provide expected text-editing behavior. |
| IsDeletePressed() | Returns true if Delete was pressed this frame, including key repeats. Useful for text editing; works regardless of whether text input mode is active. Note: unlike IsKeyPressed(Key), this fires on held-key repeats to provide expected text-editing behavior. |
| IsGamepadAxisPressed(GamepadAxis, int) | Returns true if the gamepad axis crossed the deadzone threshold this frame (was inactive last frame, active now). |
| IsGamepadAxisReleased(GamepadAxis, int) | Returns true if the gamepad axis dropped below the deadzone threshold this frame (was active last frame, inactive now). |
| IsGamepadButtonDown(GamepadButton, int) | Returns true if the gamepad button is currently pressed. |
| IsGamepadButtonPressed(GamepadButton, int) | Returns true if the gamepad button was pressed this frame. |
| IsGamepadButtonReleased(GamepadButton, int) | Returns true if the gamepad button was released this frame. |
| IsGamepadConnected(int) | Returns true if a gamepad is connected at the specified index. |
| IsGamepadTriggerPressed(GamepadAxis, int) | Returns true if the gamepad trigger crossed the deadzone threshold this frame (was inactive last frame, active now). |
| IsGamepadTriggerReleased(GamepadAxis, int) | Returns true if the gamepad trigger dropped below the deadzone threshold this frame (was active last frame, inactive now). |
| IsKeyDown(Key) | Returns true if the key is currently pressed. |
| IsKeyPressed(Key) | Returns true if the key was pressed this frame (not held from previous frame). |
| IsKeyReleased(Key) | Returns true if the key was released this frame. |
| IsMouseButtonDown(MouseButton) | Returns true if the mouse button is currently pressed. |
| IsMouseButtonPressed(MouseButton) | Returns true if the mouse button was pressed this frame. |
| IsMouseButtonReleased(MouseButton) | Returns true if the mouse button was released this frame. |
| IsReturnPressed() | Returns true if Enter/Return was pressed this frame, including key repeats. Useful for text submission; works regardless of whether text input mode is active. Note: unlike IsKeyPressed(Key), this fires on held-key repeats to provide expected text-editing behavior. |
| RumbleGamepad(float, float, TimeSpan, int) | Rumbles the gamepad using the low-frequency and high-frequency motors. Intensity values are 0.0 (off) to 1.0 (max). Duration of 0 stops rumble. |
| RumbleGamepadTriggers(float, float, TimeSpan, int) | Rumbles the gamepad triggers independently (e.g., Xbox impulse triggers). Intensity values are 0.0 (off) to 1.0 (max). Duration of 0 stops rumble. |
| StartTextInput() | Starts text input mode. Call this when a text field is focused. |
| StopTextInput() | Stops text input mode. Call this when text field loses focus. |
| Update() | Updates the input state for the current frame. Must be called exactly once per frame before processing input. |