Browse Source

Forgot to commit the new GUI.Keys module

main
Tissevert 7 months ago
parent
commit
c0d658fbf0
1 changed files with 18 additions and 0 deletions
  1. +18
    -0
      js/GUI/Keys.js

+ 18
- 0
js/GUI/Keys.js View File

@ -0,0 +1,18 @@
var bindings = {};
return {
bind: bind,
init: init
};
function bind(keyCode, f) {
bindings[keyCode] = f;
}
function init() {
window.addEventListener('keydown', function(e) {
if(bindings[e.key] != undefined) {
bindings[e.key]();
}
});
}

Loading…
Cancel
Save