Vixen
02b45cc4
csharp
public sealed class DesktopInputSource

Raw devices and the state of the keyboard and pointer.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Key and pointer state comes from SDL's own snapshot, which is refreshed by the pump. That matters more than it looks: after a window loses focus SDL knows which keys the user let go of while somebody else had them, and an input layer reconstructing state from events alone does not — which is the bug where a player alt-tabs mid-stride and comes back still walking.

Fields and properties (3)

  • public IReadOnlyList<IGamepad> Gamepads

    Every connected gamepad.

  • public KeyModifiers Modifiers

    The modifier keys held now.

  • public Vector2 PointerPosition

    Where the pointer is, in desktop coordinates and logical points.

Methods (4)

  • public DesktopInputSource(Sdl sdl)

    Raw devices and the state of the keyboard and pointer.

  • public bool TryGetGamepad(int deviceId, out IGamepad? gamepad)

    Finds a gamepad by the id its events carry.

  • public bool IsKeyDown(Key key)

    Whether a key is held, by physical position.

  • public bool IsMouseButtonDown(MouseButton button)

    Whether a mouse button is held.

Used by (1)

  • DesktopPlatformVixen.Platform.Desktop