new draw and update cycle

This commit is contained in:
Nikolai Fesenko
2025-11-28 14:15:37 +01:00
parent 2ebf70c43e
commit 208b288545
2 changed files with 61 additions and 44 deletions

View File

@@ -18,6 +18,17 @@ class Selectable {
}
}
class KeyListener {
key;
execute() {
}
executeOnKey(event_key) {
if(event_key == this.key) {
this.execute();
}
}
}
class Screen {
elements = [];
@@ -69,8 +80,6 @@ class Screen {
}
keypress(event) {
console.log(event);
if(this.user_can_select == true) {
this.select_key_event(event.key);
@@ -184,10 +193,7 @@ class MainMenu extends Screen{
}
load() {
requestAnimationFrame(this.onFrame);
document.addEventListener("keypress" , e => { this.keypress(e)});
this.user_can_select = true;
console.log(this);
}