0.2.2 • Published 4 years ago

enforcegamepad v0.2.2

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

enforceGamePad

JavaScript library for unified GamePadAPI.

Sample

  1. Clone to the "DocumentRoot" accessible from the Web.
  2. Access the directory cloned by the browser.
  3. A list of values that can be acquired with this library is displayed on the screen.
    (Please operate game pad in Firefox)

The class library is "enforceGamepad.js".

Supported Browsers

  • Firefox
  • Chrome
  • Safari 10.2(in the future)

Supported Controller

  • Xbox 360 Wired Controller (STANDARD GAMEPAD Vendor: 045e Product: 028e)
    Xbox360 Wired Controller
  • JC-U3613M - DirectInput Mode (Vendor: 056e Product: 2003)
    ELECOM Gaming Controller
  • iBUFFALO BSGP1204P Series (Vendor: 1dd8 Product: 0010)
    iBUFFALO Gaming Controller
  • 4Axes 12Key GamePad (Vendor: 0d9d Product: 3013)
    PlayStation2 Controller

How to use(CoffeeScript)

gamepad = new enforceGamepad()
gamepad.stat()
console.log(gamepad.controllers)

Information on the game pad at the time of calling the method will be returned.

pad = gamepad.controllers[0]

The above is the first connected game pad.

buttons = pad.buttons
axes = pad.axes
analog = pad.analog

With "buttons", "axes" and "analog" you can get the state of the button, the state of the four-way key, and the state of the analog stick.
(In the XBOX360 controller, the "RT" and "LT" buttons also return analog values)

Correspondence table

The name of the key conforms to XBOX360 controller.

Buttons

Button nameArray index numberValues
HOME00 or 1
A10 or 1
B20 or 1
X30 or 1
Y40 or 1
LB50 or 1
RB60 or 1
LT70 or 1(Xbox360:0~1)
RT80 or 1(Xbox360:0~1)
BACK90 or 1
START100 or 1
Left stick push110 or 1
Right stick push120 or 1

In the case of a controller without the HOME button, pressing "BACK" and "START" at the same time means pressing the HOME button.

Axes
The four-way controller has horizontal values for "axes0" and vertical values for "axes1".

Analog stick
Likewise, the analog stick has the value of left stick in "analog0" and the value of right stick in "analog1".
"analogn" contains an array of horizontal and vertical values.
It is in the horizontal direction to "analogn", the value in the vertical direction to "analogn" between 0~1.

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.0

4 years ago