mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
28 lines
1007 B
HTML
28 lines
1007 B
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<script src="gamepad-helper.js"></script>
|
|
<script>
|
|
asyncTest(async (done) => {
|
|
const gamepad = internals.connectVirtualGamepad();
|
|
await handleSDLInputEvents();
|
|
listenForGamepadConnected();
|
|
|
|
const shortMax = 32628;
|
|
|
|
const trigger = gamepad.triggers[0];
|
|
|
|
for (const axisValue of [-1.0, -0.98, -0.96, -0.94, -0.92, -0.9, -0.8033]) {
|
|
const axisValueAsInt = Math.floor(axisValue * shortMax);
|
|
println(`Before moving trigger axis ${trigger} to ${axisValue} (${axisValueAsInt}): ${getStringifiedGamepads()}`);
|
|
gamepad.setAxis(trigger, axisValueAsInt);
|
|
await handleSDLInputEvents();
|
|
println(`After moving trigger axis ${trigger} to ${axisValue} (${axisValueAsInt}): ${getStringifiedGamepads()}`);
|
|
}
|
|
|
|
listenForGamepadDisconnected();
|
|
gamepad.disconnect();
|
|
await handleSDLInputEvents();
|
|
done();
|
|
});
|
|
</script>
|