This commit is contained in:
Rim 2025-04-23 20:40:48 -04:00
parent 23ffb6ea2a
commit ae9710d724
2 changed files with 217 additions and 211 deletions

8
app.js
View File

@ -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}/`);
});
});

View File

@ -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)}`;
});