SDL3 keyboard, mouse, touch, and game controller inputs for ScrapyardIO

Maintainers

Package info

github.com/DeptOfScrapyardRobotics/sdl3-input

Homepage

pkg:composer/dept-of-scrapyard-robotics/sdl3-input

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.6.0 2026-07-30 17:41 UTC

This package is auto-updated.

Last update: 2026-07-30 17:42:53 UTC


README

Poll-based SDL3 keyboard, mouse, touch, and game-controller circuits for ScrapyardIO.

SDLInputEventHub is the sole owner of SDL's global event queue. Poll the hub (or any of its circuit-backed inputs) once per frame. It fans each event out to the relevant stateful input and to optional listeners before freeing it.

Circuit aliases:

  • sdl3-input
  • sdl3-keyboard
  • sdl3-mouse
  • sdl3-touch
  • sdl3-game-controller

Display gating

Sketches and the shared display event-pump bridge activate only when dept-of-scrapyard-robotics/sdl3-display is installed. Alone, this package registers circuits/actuators but does not open windows or steal the SDL queue from a display.

When both packages are present, display presentation pumps through the shared owner and cannot steal keyboard, pointer, touch, or controller events.

Controller notes (ext-sdl3 0.5)

sdl3-display only boots SDL_INIT_VIDEO. The hub calls Init::initSubSystem(SDL_INIT_GAMEPAD) on poll, syncs already-connected pads, and samples sticks/buttons via Gamepad::getGamepadAxis / Gamepad::getGamepadButton.

ext-sdl3's SDLReadEvent does not implement jdevice / gdevice / gaxis / gbutton (unsupported keys free the event and throw). Joystick/gamepad queue events are decoded from getEventDescription() instead.

Visual demos

php workshop sketch sdl3-keyboard-input
php workshop sketch sdl3-mouse-input
php workshop sketch sdl3-controller-input

Each demo opens an SDL3 windowed UI via Visual::display('windowed', 'sdl3') and renders live device state plus a recent-event log. Close the window or press Ctrl+C to stop.

Run the package suite from this directory with:

../../vendor/bin/pest --configuration phpunit.xml