Package Exports
- terminal-joystick
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (terminal-joystick) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
terminal-joystick
🎮 A joystick for your terminal.

⚠️ Highly experimental
Install
npm i -S terminal-joystickUsage
const { TerminalJoystick, ON_DRAG } = require('terminal-joystick');
const joystick = new TerminalJoystick({
title : 'Joystick - Example',
});
joystick.on(ON_DRAG, ({ angle, intensity }) => {
// Do stuff...
});
joystick.on(ON_DRAG_END, ({ angle, intensity }) => {
// Do stuff...
});Using with blessed
To add terminal-joystick to an existing blessed application, you just need to provide a reference to the blessed.screen object and a parent container :
const { TerminalJoystick, ON_DRAG } = require('terminal-joystick');
const screen = blessed.screen();
const container = new blessed.Box({
left : 'center',
top : 'center',
width : '100%',
height : '100%',
});
const joystick = new TerminalJoystick({
parent : container,
title : 'Joystick - Example',
screen,
});
joystick.on(ON_DRAG, ({ angle, intensity }) => {
// Do stuff...
});API
new TerminalJoystick(opts)screen: reference to an existingblessedscreen (optional)container:size: pad's size (default : 100)- All
blessed.Elementproperties
joystick:size: joystick's size (default : 15)- All
blessed.Elementproperties
title: terminal tab title (optional) / Only used ifscreenis not providednoReturnToOrigin: A flag to disable the joystick return to its initial position when mouse click is released.
on(event, handler):TerminalJoystickextendsEventEmitter.ON_DRAG: emitted when the joystick is dragged.angle: angle in degress (0-360) between the joystick and the x-axis.intensity: distance from the center (0-1)x: coordinate along the x-axis between -1 and 1y: coordinate along the y-axis between -1 and 1
ON_DRAG_END: emitted when the mouse click is released.