buttons-delta ( old-buttons new-buttons -- delta )
Game controller input

Prev:button-delta ( old? new? -- delta )
Next:buttons-delta-as ( old-buttons new-buttons exemplar -- delta )


Inputs and outputs
old-buttonsa sequence
new-buttonsa sequence
deltaan array of pressed, released, or f

Word description
Outputs an array of symbols representing the change in a set of keys or buttons' states given "before" and "after" samples of their state. For each corresponding pair of values in the two input sequences, outputs pressed if old-buttons contains a false and new-buttons a true value, released if old-buttons contains true and new-buttons false, or f if the two elements have the same boolean value.

This word can be used with two samples of a keyboard-state's keys slot or of a mouse-state's or controller-state's buttons slot to convert the button states into pressed/released values. Remember to clone state objects to record snapshots of their state.

See also
button-delta, buttons-delta-as


: buttons-delta ( old-buttons new-buttons -- delta )
{ } buttons-delta-as ; inline