-
Notifications
You must be signed in to change notification settings - Fork 1
/
userInterface.js
75 lines (62 loc) · 1.93 KB
/
userInterface.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const chalk = require("chalk");
const figlet = require("figlet");
// const cliProgress = require("cli-progress");
function logInfo(message) {
console.log(chalk.cyan(message));
}
function logWarning(message) {
console.log(chalk.yellow(message));
}
function logError(...messages) {
console.error(chalk.red(...messages));
}
function logFeedback(message) {
console.log(chalk.green(message));
}
function setupUI() {
console.log(chalk.yellow(figlet.textSync("BeamNG + G29", { horizontalLayout: "full" })));
console.log(
chalk.cyan(`
[INFO] Logitech G29 & BeamNG.drive utility\n
This utility connects your Logitech G29 steering wheel's LED's\nwith BeamNG.drive game by reading the car's RPM data.
`)
);
}
let gasPedalProgressBar;
let brakePedalProgressBar;
let clutchPedalProgressBar;
function createProgressBars() {
// Create progress bars for pedals
// logFeedback("\nGas Pedal:");
// gasPedalProgressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);
// gasPedalProgressBar.start(100, 0);
// logFeedback("\nBrake Pedal:");
// brakePedalProgressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);
// brakePedalProgressBar.start(100, 0);
// logFeedback("\nClutch Pedal:");
// clutchPedalProgressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);
// clutchPedalProgressBar.start(100, 0);
}
function updateProgressBar(progressBar, value) {
// progressBar.update(value);
}
function updateGasPedalProgressBar(value) {
updateProgressBar(gasPedalProgressBar, value);
}
function updateBrakePedalProgressBar(value) {
updateProgressBar(brakePedalProgressBar, value);
}
function updateClutchPedalProgressBar(value) {
updateProgressBar(clutchPedalProgressBar, value);
}
module.exports = {
logInfo,
logWarning,
logError,
logFeedback,
setupUI,
createProgressBars,
updateGasPedalProgressBar,
updateBrakePedalProgressBar,
updateClutchPedalProgressBar,
};