fixed input

main
Codinget 5 years ago
parent 39e761d334
commit 2df2f5f992
  1. 6
      src/js/input.js

@ -13,6 +13,7 @@ const handleAngleMagnitude=(x, y, threshold=0, fn=null, clearBuffer=false) => {
const {angle, magnitude}=toAngleMagnitude(x, y);
if(magnitude>threshold) {
let inputs=currentInputs;
if(angle>.25 && angle <.75) inputs.right=true;
else if(angle>.75 && angle<1.25) inputs.up=true;
else if(angle>1.25 && angle<1.75) inputs.left=true;
@ -69,7 +70,7 @@ const handleJoystick=(() => {
!config.touchscreen.buffer
)
}
});
})();
const handleSwipe=(() => {
let center={
@ -91,7 +92,7 @@ const handleSwipe=(() => {
!config.touchscreen.buffer
)
}
});
})();
const handleGamepads={
frame: () => {
@ -111,6 +112,7 @@ const handleGamepads={
const handleEvent=(type, evt) => {
for(let handler of handlers) {
console.log(type, handler);
let fn=handler[type];
if(fn) fn(evt);
}

Loading…
Cancel
Save