You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is a slightly modified version of the gamepad test script (used to verify this bug).
On-screen button fill color is green when exitOnMenuPress = true, and red when exitOnMenuPress = false. (Note: testing with SteelSeries Nimbus controller)
Steps to reproduce:
launch app
press R1 (sets exitOnMenuPress = false)
press Menu button (does not exit as it should)
press B button (does not exit as it should)
press L1 (exitOnMenuPress = true)
press Menu button or B button (exits app)
press A button (to re-enter app)
press R1 (exitOnMenuPress = false)
press Menu button (does not exit as it should)
press B button (app exits! From this point on, no matter what exitOnMenuPress is set to the B button will exit)
canvas.width = window.innerWidth * window.devicePixelRatio;
canvas.height = window.innerHeight * window.devicePixelRatio;
canvas.style.width = window.innerWidth + "px";
canvas.style.height = window.innerHeight + "px";
var ctx = canvas.getContext("2d");
var scale = canvas.width / 1280;
ctx.scale(scale, scale);
ctx.font = '32px Helvetica';
ctx.fillStyle = '#fff';
ctx.strokeStyle = '#fff';
ctx.lineWidth = 2;
var drawButton = function(button, x, y, action, gamepad) {
ctx.fillRect(x - 24, y + 24 - 48 * button.value, 48, 48 * button.value );
if (button.pressed && action === 'enable') {
gamepad.exitOnMenuPress = true;
} else if (button.pressed && action === 'disable') {
gamepad.exitOnMenuPress = false;
}
ctx.strokeStyle = button.pressed ? '#0f0' : '#ccc';
ctx.strokeRect(x - 24, y - 24, 48, 48);
ctx.strokeStyle = '#fff';
};
var drawAnalogStick = function( axisX, axisY, x, y ) {
ctx.beginPath();
ctx.arc(x, y, 64, 0, 2*Math.PI);
ctx.stroke();
ctx.beginPath();
ctx.arc(x + axisX*48, y + axisY*48, 16, 0, 2*Math.PI);
ctx.fill();
};
setInterval(function(){
ctx.clearRect(0, 0, canvas.width/scale, canvas.height/scale);
var gamepads = navigator.getGamepads();
var gamepad = gamepads[1] || gamepads[0];
if (gamepad.exitOnMenuPress) {
ctx.fillStyle = "green";
} else {
ctx.fillStyle = "red";
}
if( !gamepad ) {
ctx.fillText('No Gamepads connected', 32, 32);
return;
}
ctx.fillText('Using Gamepad: #' + gamepad.index + ' ('+gamepad.id+')', 32, 32);
// Button Mappings according to http://www.w3.org/TR/gamepad/#remapping
drawButton(gamepad.buttons[0], 928, 354); // A
drawButton(gamepad.buttons[1], 994, 288); // B
drawButton(gamepad.buttons[2], 862, 288); // X
drawButton(gamepad.buttons[3], 928, 224); // Y
drawButton(gamepad.buttons[4], 412, 96, 'enable', gamepad); // L1
drawButton(gamepad.buttons[5], 868, 96, 'disable', gamepad); // R1
drawButton(gamepad.buttons[6], 288, 96); // L2
drawButton(gamepad.buttons[7], 994, 96); // R2
drawButton(gamepad.buttons[12], 352, 224); // Up
drawButton(gamepad.buttons[13], 352, 354); // Down
drawButton(gamepad.buttons[14], 288, 288); // Left
drawButton(gamepad.buttons[15], 416, 288); // Right
drawButton(gamepad.buttons[16], 640, 196); // Menu
drawAnalogStick(gamepad.axes[0], gamepad.axes[1], 540, 416); // left stick
drawAnalogStick(gamepad.axes[2], gamepad.axes[3], 736, 416); // right stick
}, 16);
The text was updated successfully, but these errors were encountered:
Below is a slightly modified version of the gamepad test script (used to verify this bug).
On-screen button fill color is green when exitOnMenuPress = true, and red when exitOnMenuPress = false. (Note: testing with SteelSeries Nimbus controller)
Steps to reproduce:
The text was updated successfully, but these errors were encountered: