HTML5-JavaScript-Gamepad-Controller-Library
HTML5-JavaScript-Gamepad-Controller-Library copied to clipboard
gamepad.bind(Gamepad.Event.BUTTON_UP) not working
the BUTTON_DOWN one works but the BUTTON_UP one does nothing
2023 The problem is relevant
Maybe the problem is here need to fix
updater = function() {
var value = getter();
var lastValue = gamepad.lastState[controlName];
var isDown = value > 0.5;
var wasDown = lastValue > 0.5;
gamepad.state[controlName] = value;
if (isDown && !wasDown) {
that._fire(Gamepad.Event.BUTTON_DOWN, Object.create(buttonEventData));
} else if (!isDown && wasDown) {
that._fire(Gamepad.Event.BUTTON_UP, Object.create(buttonEventData));
}
if ((value !== 0) && (value !== 1) && (value !== lastValue)) {
that._fireAxisChangedEvent(gamepad, controlName, value);
}
gamepad.lastState[controlName] = value;
};
Autor please fix that