implement touch control
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user