Skip to content

Commit

Permalink
Update README.
Browse files Browse the repository at this point in the history
  • Loading branch information
vaneenige committed Jul 24, 2018
1 parent ce2b88f commit 7c32c45
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import Unswitch from 'unswitch';

// Create the listener
const unswitch = new Unswitch({
side: 'L', // or R
b: (pressed) => {},
a: (pressed) => {},
y: (pressed) => {},
Expand All @@ -50,7 +51,7 @@ function render() {
render();
```

Calling `unswitch.update()` will check every button for a change in state. If a callback is provided the new state is passed along. The axis works in the same way, but instead of a `boolean` it will return a `number` from 0 to 8. Number 0 to 7 are for the joystick positions going clockwise, number 8 is used as default (center).
It's possible to connect up to two controllers at the same time. To make this work `side` is to be passed with either `L` (left) or `R` (right) for the controllers respectively. Calling `unswitch.update()` will check every button for a change in state. If a callback is provided the new state is passed along. The axis works in the same way, but instead of a `boolean` it will return a `number` from 0 to 8. Number 0 to 7 are for the joystick positions going clockwise, number 8 is used as default (center).

> Buttons are mapped based on a single controller positioned horizontally.
Expand Down

0 comments on commit 7c32c45

Please sign in to comment.