Skip to content

Commit

Permalink
Add keyboard shortcuts
Browse files Browse the repository at this point in the history
Ctrl-S => start
Ctrl-O => ○
Ctrl-X => ×
  • Loading branch information
amatsuda committed Aug 15, 2024
1 parent b92bdc6 commit 675c22a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,14 @@ class Game {
}
}

document.addEventListener('keydown', event => {
if (event.key === 's' && event.ctrlKey) {
game.wait();
} else if (event.key === 'o' && event.ctrlKey) {
game.answering && game.correct();
} else if (event.key === 'x' && event.ctrlKey) {
game.answering && game.incorrect();
}
});

game = new Game();

0 comments on commit 675c22a

Please sign in to comment.