1.1.1 • Published 7 years ago
node-console-interface v1.1.1
Functions
getConsoleGridInterfaceInput (horizontalBorder, verticalBorder, spacer, marker, startX, startY, borderWidth, borderHeight, showCoords, showIntructions, deleteOnCompletion)
Basic Overview
Will display a grid for the user to move around a marker with WASD keys in order to select a pair of co-ordinates.
Variables
horizontalBorder
refers to the top and bottom border characters.verticalBorder
refers to the left and right border characters.spacer
refers to the characters inside the grid. (Space is recommended)marker
refers to the marker character that will be put at the selected co-ordinates.startX
andstartY
refers to where the marker character will start on the grid.borderWidth
andborderHeight
refers to the width and height of the grid.- If
showCoords
is true, the user will see their X and Y position at the bottom of the console window. - If
showInstructions
is true, the user will see instructions on how to use the interface at the top of the console window. - If
deleteOnCompletion
is true, the grid will be deleted once the user selects their co-ordinates.
Usage
Input:
const conif = require('node-console-interface');
var coords = conif.getConsoleGridInterfaceInput('-', '|', ' ', 'O', 25, 12, 50, 25, true, true, true);
console.log('PosX: ' + coords.x);
console.log('PosY: ' + coords.y);
Output:
getConsoleSliderInterfaceInput (leftEndChar, rightEndChar, spacer, marker, startValue, sliderWidth, showValue, showIntructions, deleteOnCompletion)
Basic Overview
Will display a slider for the user to move around a marker with A and D keys in order to select a value.
Variables
leftEndChar
refers to the character that will be on the left of the slider.rightEndChar
refers to the character that will be on the right of the slider.spacer
refers to the characters inside the slider. ('-'
is recommended)marker
refers to the marker character that will be put at the selected value.startValue
refers to where the marker character will start on the slider.sliderWidth
refers to the width and height of the slider.- If
showValue
is true, the user will see the value at the right of the slider. - If
showInstructions
is true, the user will see instructions on how to use the interface at the top of the console window. - If
deleteOnCompletion
is true, the slider will be deleted once the user selects their co-ordinates.
Usage
Input:
const conif = require('node-console-interface');
var value = conif.getConsoleSliderInterfaceInput('<', '> ', '-', 'O', 25, 50, true, true, true);
console.log('Value: ' + value + '\n');
Output:
getConsoleSelectionListInterfaceInput (marker, selectedMarker, startPosition, items, showIntructions, deleteOnCompletion)
Basic Overview
Will display a list in which the user and move a marker up and down in order to select a particular item.
Variables
marker
refers to the marker put next to each item on the list.selectedMarker
refers to the marker put next to an item on the list when it is selected.startPosition
refers to the start position of the selection.items
refers to the array of items in the list.- If
showInstructions
is true, the user will see instructions on how to use the interface at the top of the console window. - If
deleteOnCompletion
is true, the list will be deleted once the user selects their item.
Usage
Input:
const conif = require('node-console-interface');
var items = new Array();
items.push("Name1");
items.push("Name2");
items.push("Name3");
items.push("Name4");
var selection = conif.getConsoleSelectionListInterfaceInput('| ', 'O ', 1, items, true, true);
console.log('Selection: ' + selection + '\n');
Output: