1.0.0 • Published 9 months ago

gamepad-library v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Gamepad Library

A suite of Gamepads for use in browser-based applications (for ex. games).

Supported Devices

  • XInput-compliant controllers (ex. Xbox 360)
  • Create a PR to add more!

Usage example in applications

const { XInput } = require("gamepad-library");

const inputMethod = new XInput();

// in some sort of polling loop

const pad = navigator.getGamepads()[0];
// assuming it is indeed a XInput

const buttons = inputMethod.getPressedButtons(pad);

// check if B button is pressed

if (buttons.includes("B")) {
  // hadoken
}
1.0.0

9 months ago