-
Notifications
You must be signed in to change notification settings - Fork 11
Home
#Xbox Controller Inteface API
Wiki of usage and xbox-controller-node
events
var xbox = require('xbox-controller-node');
###xbox.configure();
- This will launch a server page on browser to you configure your controller. The page will be available on http://localhost:3000.
###xbox.listHIDDevices();
- List all HID devices connected in your computer.
###xbox.CreateController(HIDInfo);
- Try to create another
xbox-controller-node
with the passed HIDInfo configs.
##Button events
###Event: "a"
Fire when the a
button is pressed
###Event: "b"
Fire when the b
button is pressed
###Event: "x"
Fire when the x
button is pressed
###Event: "y"
Fire when the y
button is pressed
###Event: "rb"
Fire when the rb
button is pressed
###Event: "lb"
Fire when the lb
button lb pressed
###Event: "start"
Fire when the start
button is pressed
###Event: "back"
Fire when the back
button is pressed
###Event: "xboxButton" (Only available on linux)
Fire when the xbox
button is pressed
###Event: "up"
Fire when the up
button is pressed
###Event: "down"
Fire when the down
button is pressed
###Event: "left"
Fire when the left
button is pressed
###Event: "right"
Fire when the right
button is pressed
###Event: "upright"
Fire when the upright
buttons combination is pressed
###Event: "upleft"
Fire when the upleft
buttons combination is pressed
###Event: "downright"
Fire when the downright
buttons combination is pressed
###Event: "downleft"
Fire when the downleft
buttons combination is pressed
###Event: "leftstickpress"
Fire when the left stick
button is pressed
###Event: "rightstickpress"
Fire when the right stick
button is pressed
##Stick events
###Event: "leftstickLeft"
Fire when the left stick
is moved to left
###Event: "leftstickRight"
Fire when the left stick
is moved to right
###Event: "leftstickDown"
Fire when the left stick
is moved to down
###Event: "leftstickUp"
Fire when the left stick
is moved to up
###Event: "leftstickMove" : position
Fire when the left stick
is moved to any position. Return a object containing the x
and y
coordinates
###Event: "rightstickLeft"
Fire when the right stick
is moved to left
###Event: "rightstickRight"
Fire when the right stick
is moved to right
###Event: "rightstickDown"
Fire when the right stick
is moved to down
###Event: "rightstickUp"
Fire when the right stick
is moved to up
###Event: "rightstickMove" : position
Fire when the right stick
is moved to any position. Return a object containing the x
and y
coordinates
##Events: "[button]:release" Fire just when the button is released
##Events: "[button]:none" Fire to all buttons and events that was not pressed or actived
##Events usage
/* Button events */
xbox.on('a', function () {
console.log('[A] button press');
});
xbox.on('b', function () {
console.log('[B] button press');
});
xbox.on('y', function () {
console.log('[Y] button press');
});
xbox.on('x', function () {
console.log('[X] button press');
});
xbox.on('rb', function () {
console.log('[RB] button press');
});
xbox.on('lb', function () {
console.log('[LB] button press');
});
xbox.on('start', function () {
console.log('[Start] button press');
});
//This event is only avaliable on linux
xbox.on('xboxButton', function () {
console.log('[Xbox] button press');
});
xbox.on('back', function () {
console.log('[Back] button press');
});
xbox.on('up', function () {
console.log('[UP] button press');
});
xbox.on('down', function () {
console.log('[DOWN] button press');
});
xbox.on('left', function () {
console.log('[LEFT] button press');
});
xbox.on('right', function () {
console.log('[RIGHT] button press');
});
xbox.on('upright', function () {
console.log('[UPRIGHT] buttons combination press');
});
xbox.on('upleft', function () {
console.log('[UPLEFT] buttons combination press');
});
xbox.on('downright', function () {
console.log('[DOWNRIGHT] buttons combination press');
});
xbox.on('downleft', function () {
console.log('[DOWNLEFT] buttons combination press');
});
xbox.on('leftstickpress', function () {
console.log('[LEFTSTICK] button press');
});
xbox.on('rightstickpress', function () {
console.log('[RIGHTSTICK] button press');
});
/* Stick events */
xbox.on('leftstickLeft', function () {
console.log('Moving [LEFTSTICK] LEFT');
});
xbox.on('leftstickRight', function () {
console.log('Moving [LEFTSTICK] RIGHT');
});
xbox.on('leftstickDown', function () {
console.log('Moving [LEFTSTICK] DOWN');
});
xbox.on('leftstickUp', function () {
console.log('Moving [LEFTSTICK] UP');
});
xbox.on('leftstickMove', function (position) {
console.log('[LEFTSTICK] position:', position);
});
xbox.on('rightstickLeft', function () {
console.log('Moving [RIGHTSTICK] LEFT');
});
xbox.on('rightstickRight', function () {
console.log('Moving [RIGHTSTICK] RIGHT');
});
xbox.on('rightstickDown', function () {
console.log('Moving [RIGHTSTICK] DOWN');
});
xbox.on('rightstickUp', function () {
console.log('Moving [RIGHTSTICK] UP');
});
xbox.on('rightstickMove', function (position) {
console.log('[RIGHTSTICK] position:', position);
});
/* Buttons release events */
xbox.on('a:release', function () {
console.log('[A] button release');
});
xbox.on('b:release', function () {
console.log('[B] button release');
});
xbox.on('y:release', function () {
console.log('[Y] button release');
});
xbox.on('x:release', function () {
console.log('[X] button release');
});
xbox.on('rb:release', function () {
console.log('[RB] button release');
});
xbox.on('lb:release', function () {
console.log('[LB] button release');
});
xbox.on('start:release', function () {
console.log('[START] button release');
});
//This event is only avaliable on linux
xbox.on('xboxButton:release', function () {
console.log('[Xbox] button release');
});
xbox.on('back:release', function () {
console.log('[BACK] button release');
});
xbox.on('up:release', function () {
console.log('[UP] button release');
});
xbox.on('down:release', function () {
console.log('[DOWN] button release');
});
xbox.on('left:release', function () {
console.log('[LEFT] button release');
});
xbox.on('right:release', function () {
console.log('[RIGHT] button release');
});
xbox.on('upright:release', function () {
console.log('[UPRIGHT] buttons combination release');
});
xbox.on('upleft:release', function () {
console.log('[UPLEFT] buttons combination release');
});
xbox.on('downright:release', function () {
console.log('[DOWNRIGHT] buttons combination release');
});
xbox.on('downleft:release', function () {
console.log('[DOWNLEFT] buttons combination release');
});
xbox.on('leftstickpress:release', function () {
console.log('[LEFTSTICK] button release');
});
xbox.on('rightstickpress:release', function () {
console.log('[RIGHTSTICK] button release');
});
/* Buttons none events */
xbox.on('a:none', function () {
console.log('The [A] button is released');
});
xbox.on('b:none', function () {
console.log('The [B] button is released');
});
xbox.on('y:none', function () {
console.log('The [Y] button is released');
});
xbox.on('x:none', function () {
console.log('The [X] button is released');
});
xbox.on('rb:none', function () {
console.log('The [RB] button is released');
});
xbox.on('lb:none', function () {
console.log('The [LB] button is released');
});
xbox.on('start:none', function () {
console.log('The [Start] button is released');
});
//This event is only avaliable on linux
xbox.on('xboxButton:none', function () {
console.log('[Xbox] button is released');
});
xbox.on('back:none', function () {
console.log('The [Back] button is released');
});
xbox.on('up:none', function () {
console.log('The [UP] button is released');
});
xbox.on('down:none', function () {
console.log('The [DOWN] button is released');
});
xbox.on('left:none', function () {
console.log('The [LEFT] button is released');
});
xbox.on('right:none', function () {
console.log('The [RIGHT] button is released');
});
xbox.on('upright:none', function () {
console.log('The [UPRIGHT] buttons combination is released');
});
xbox.on('upleft:none', function () {
console.log('The [UPLEFT] buttons combination is released');
});
xbox.on('downright:none', function () {
console.log('The [DOWNRIGHT] buttons combination is released');
});
xbox.on('downleft:none', function () {
console.log('The [DOWNLEFT] buttons combination is released');
});
xbox.on('leftstickpress:none', function () {
console.log('The [LEFTSTICK] button is released');
});
xbox.on('rightstickpress:none', function () {
console.log('The [RIGHTSTICK] button is released');
});
/* Stick release events */
xbox.on('leftstickLeft:release', function () {
console.log('Released [LEFTSTICK] LEFT');
});
xbox.on('leftstickRight:release', function () {
console.log('Released [LEFTSTICK] RIGHT');
});
xbox.on('leftstickDown:release', function () {
console.log('Released [LEFTSTICK] DOWN');
});
xbox.on('leftstickUp:release', function () {
console.log('Released [LEFTSTICK] UP');
});
xbox.on('rightstickLeft:release', function () {
console.log('Released [RIGHTSTICK] LEFT');
});
xbox.on('rightstickRight:release', function () {
console.log('Released [RIGHTSTICK] RIGHT');
});
xbox.on('rightstickDown:release', function () {
console.log('Released [RIGHTSTICK] DOWN');
});
xbox.on('rightstickUp:release', function () {
console.log('Released [RIGHTSTICK] UP');
});
/* Sticks none events */
xbox.on('leftstickLeft:none', function () {
console.log('Not moving [LEFTSTICK] LEFT');
});
xbox.on('leftstickRight:none', function () {
console.log('Not moving [LEFTSTICK] RIGHT');
});
xbox.on('leftstickDown:none', function () {
console.log('Not moving [LEFTSTICK] DOWN');
});
xbox.on('leftstickUp:none', function () {
console.log('Not moving [LEFTSTICK] UP');
});
xbox.on('rightstickLeft:none', function () {
console.log('Not moving [RIGHTSTICK] LEFT');
});
xbox.on('rightstickRight:none', function () {
console.log('Not moving [RIGHTSTICK] RIGHT');
});
xbox.on('rightstickDown:none', function () {
console.log('Not moving [RIGHTSTICK] DOWN');
});
xbox.on('rightstickUp:none', function () {
console.log('Not moving [RIGHTSTICK] UP');
});