Skip to content
php-baremetal REGISTRY
Publish a package

php-baremetal/ext-input

bm-ext MIT

Touch input for php-baremetal: the Touch interface, the Pressed/Moved/Released/Gesture events and a C API for touch drivers. Platform-neutral.

ext-input

ext-input defines how a touch screen talks to a script, without knowing which chip is behind it.

  • Baremetal\Input\Touch: the interface a touch driver implements. point() reads the point touched now, events() turns on the events.
  • Pressed, Moved, Released and Gesture: the events a touch device raises on the event bus of ext-events. They share the abstract base TouchEvent, with the coordinates $x and $y.
  • GestureType: the enum of the gestures a controller can recognise (swipes, tap, double tap, long press).
  • A small C API (bm_input.h) for the driver authors.

The coordinates are the ones of the screen, so a driver applies the orientation of the panel before it raises an event. There is one finger: the events describe a single point.

ext-input needs ext-events 1.1 or later and nothing else: no bus, no pin and no platform code. Events work in the event-driven runtime.

See Events for the PHP side and C API for touch drivers for the driver side.