implement touch control

This commit is contained in:
LabyStudio
2022-02-13 10:49:43 +01:00
parent a7482c52f1
commit 300e05c7e3
3 changed files with 154 additions and 6 deletions
+9 -1
View File
@@ -4,7 +4,7 @@ window.Keyboard = class {
static create() {
window.addEventListener('keydown', function (event) {
event.preventDefault();
//event.preventDefault();
Keyboard.state[event.code] = true;
//console.log("Key " + event.code + " down");
});
@@ -15,6 +15,14 @@ window.Keyboard = class {
});
};
static setState(key, state) {
Keyboard.state[key] = state;
}
static unPressAll() {
Keyboard.state = {};
}
static isKeyDown(key) {
return Keyboard.state[key];
}