reprocessing
reprocessing copied to clipboard
Key press detections fails with certain combos
I'm using keyCode detection in a simple game. I have H J K L as motion keys and Space as a firing key.
When H and one of [J K L] are pressed in combination with Space, the Space is not detected.
My guess is that it's an upstream bug, but I wasn't sure where to look.
The following is code I implemented to produce a string of pressed keys for debugging purposes.
let keyStringMap: Reprocessing_Common.KeySet.elt => string =
fun
| H => "H"
| J => "J"
| K => "K"
| L => "L"
| Space => "Space"
| Nothing => ""
| _ => "";
let getKeyMap = env : list(string) =>
List.map(key => Env.key === key ? key : Nothing, [H, J, K, L, Space])
|> List.map(keyStringMap);
Is your example right? It seems like that wouldn't compile (looking at the usage of Env.key)
You're right it should be like this;
let getKeyMap = env : list(string) =>
List.map(key => Env.key(key, env) ? key : Nothing, [H, J, K, L, Space])
|> List.map(keyStringMap);
Hmm, not totally sure what's happening. You see it consistently for some key combos but not others? When you use the keyPressed / keyReleased callbacks, do they get triggered correctly? Will take a closer look when I get a chance. Are you seeing this in native or web?