dept-of-scrapyard-robotics / sdl3-input
SDL3 keyboard, mouse, touch, and game controller inputs for ScrapyardIO
Package info
github.com/DeptOfScrapyardRobotics/sdl3-input
pkg:composer/dept-of-scrapyard-robotics/sdl3-input
Requires
- php: ^8.4|^8.5|^8.6
- ext-sdl3: ^0.5.0
- fabricate/actuation: ^0.6.0
- fabricate/circuits: ^0.6.0
- fabricate/contracts: ^0.6.0
- fabricate/nuts-and-bolts: ^0.6.0
- fabricate/sketches: ^0.6.0
- microscrap/sdl3: ^0.5.0
- waveforms/input: ^0.6.0
Requires (Dev)
- pestphp/pest: ^4
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-inputsdl3-keyboardsdl3-mousesdl3-touchsdl3-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