sprig icon indicating copy to clipboard operation
sprig copied to clipboard

Button keydown-holding functions differently on device vs. web

Open Sheepy3 opened this issue 1 year ago • 6 comments

when you press a button once on the physical console, the console registers that as a single input. On the web, however, holding down a button causes multiple inputs. This should be corrected so that inputs are consistent between the web and spade.

Sheepy3 avatar Nov 29 '23 18:11 Sheepy3

@leomcelroy please verify exactly what we want to do here to make things consistent - my $0.02 is that it may be the case that users have tested more on the website, and thus perhaps the behavior there is what should be retained...?

grymmy avatar Nov 29 '23 19:11 grymmy

The intended behavior is for button presses to trigger once, not repeatedly.

leomcelroy avatar Dec 02 '23 21:12 leomcelroy

ROOM makes use of holding down keys on web to move the player, so changing this behavior would make the game unplayable. As a compromise, perhaps there could be an API for changing settings?

setSettings({
  keydownRepeat: true // default: false
});

// or expose a `sprig` or `sprigSettings` next to `api`

sprig.keydownRepeat = true;

Technical note: KeyboardEvent.repeat is not reliable for determining repeated keydown events. This is confirmed by MDN docs.

Supercolbat avatar Jan 15 '24 17:01 Supercolbat

Wow that game is amazing.

leomcelroy avatar Jan 16 '24 14:01 leomcelroy

@DevIos01 are you still interested in working on this?

recursiveforte avatar Jun 07 '24 19:06 recursiveforte

Hey @recursiveforte feel free to take it if you want, currently stuck on hardware stuff so you can take over this issue :)

DevIos01 avatar Jun 07 '24 21:06 DevIos01