touch library

Touch controls for a game on a device with no keyboard, on the input layer of flutter3d_game: every control writes the same InputState a key or a pad button does, so the game cannot tell which it was.

  • TouchControls — a stick, a cluster of buttons, a row of switches, numbered slots and a switch in the corner, placed by how often each is wanted;
  • TouchDrive — a steering band and pedals laid out for a vehicle, with one button in the far corner;

and the pieces they are built from, for a game that lays out its own:

One widget for each job: the stick-and-row layout and the one with slots and a corner were two widgets until 1.0.0-rc.1, and so were the round button and the pedal.

Classes

PedalSize
The size of a TouchButton.pedal, as TouchButton.pedal holds it.
SteeringBand
A strip a thumb slides along to steer: one analogue axis, as two actions' magnitudes.
TouchAction
One labelled button on a touch screen.
TouchButton
A button that holds an action down while a finger is on it: round for a thumb's cluster, or a pedal (TouchButton.pedal) for a control held for whole corners at a time.
TouchControls
A thumb stick and some buttons, drawn over a game that has no keyboard, with numbered slots and switches where a game has them.
TouchDrive
A wheel and pedals, drawn over a game nobody can reach a keyboard for.
TouchSlot
One numbered slot, as the row draws it.
TouchSlots
The numbered slots, as buttons for a thumb.
TouchStick
A stick under a thumb, reporting into a DualAxisAction — walking, DualAxisAction.move, unless told otherwise.
TouchToggle
A round button that is set rather than held: tapped once it is on, tapped again it is off.