format
This commit is contained in:
parent
23ffb6ea2a
commit
ae9710d724
6
app.js
6
app.js
@ -20,8 +20,7 @@ const mimeTypes = {
|
||||
".txt": "text/plain",
|
||||
};
|
||||
|
||||
http
|
||||
.createServer((req, res) => {
|
||||
http.createServer((req, res) => {
|
||||
// Parse the URL and extract just the pathname, ignoring query parameters
|
||||
const parsedUrl = url.parse(req.url);
|
||||
let filePath = "." + decodeURIComponent(parsedUrl.pathname);
|
||||
@ -39,7 +38,6 @@ http
|
||||
res.end(content);
|
||||
}
|
||||
});
|
||||
})
|
||||
.listen(port, host, () => {
|
||||
}).listen(port, host, () => {
|
||||
console.log(`Server running at http://${host}:${port}/`);
|
||||
});
|
||||
|
12
index.html
12
index.html
@ -223,13 +223,21 @@
|
||||
axes.forEach(({ axis, value }, ndx) => {
|
||||
const off = ndx * 2;
|
||||
axis.setAttributeNS(null, "cx", gamepad.axes[off] * fudgeFactor);
|
||||
axis.setAttributeNS(null, "cy", gamepad.axes[off + 1] * fudgeFactor);
|
||||
axis.setAttributeNS(
|
||||
null,
|
||||
"cy",
|
||||
gamepad.axes[off + 1] * fudgeFactor,
|
||||
);
|
||||
value.textContent = `${gamepad.axes[off].toFixed(2).padStart(5)},${gamepad.axes[off + 1].toFixed(2).padStart(5)}`;
|
||||
});
|
||||
buttons.forEach(({ circle, value }, ndx) => {
|
||||
const button = gamepad.buttons[ndx];
|
||||
circle.setAttributeNS(null, "r", button.value * fudgeFactor);
|
||||
circle.setAttributeNS(null, "fill", button.pressed ? "red" : "gray");
|
||||
circle.setAttributeNS(
|
||||
null,
|
||||
"fill",
|
||||
button.pressed ? "red" : "gray",
|
||||
);
|
||||
value.textContent = `${button.value.toFixed(2)}`;
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user