How to detect simultaneous keypress in p5.js

#1

I’m trying to implement an undo functionality in a sketch. I need to detect simultaneous key press in p5. i.e ‘Ctrl’ and ‘z’ together? Is it possible?

1 Like
#2

like this?
https://editor.p5js.org/kll/sketches/j0ybQZIxHD

2 Likes
#3

p5js.org/reference/#/p5/keyTyped

function keyTyped() {
  const k = keyCode;

  if (k == 26)  print('CTRL + Z');

  return false;
}
2 Likes