This commit is contained in:
2026-09-26 18:06:05 -03:00
parent 01a81b926e
commit e22f12c0b6
12 changed files with 215 additions and 35 deletions
+6 -5
View File
@@ -89,7 +89,8 @@ export class InputManager {
static mouse_delta_y = 0;
static wheel_delta = 0;
static typed_characters = new Set<string>();
// in the order they were typed. a list, since the same letter can be typed twice in one frame
static typed_characters: string[] = [];
static pointer_lock_flag = false;
static mouse_grab_timer = 0;
@@ -108,7 +109,7 @@ export class InputManager {
}
this.keys_down.add(e.code);
if (e.key.length === 1) {
this.typed_characters.add(e.key);
this.typed_characters.push(e.key);
}
});
@@ -221,8 +222,8 @@ export class InputManager {
}
static get_typed_characters(): string[] {
const chars = [...this.typed_characters];
this.typed_characters.clear();
const chars = this.typed_characters;
this.typed_characters = [];
return chars;
}
@@ -234,7 +235,7 @@ export class InputManager {
this.mouse_delta_x = 0;
this.mouse_delta_y = 0;
this.wheel_delta = 0;
this.typed_characters.clear();
this.typed_characters = [];
this.mouse_buttons_consumed.clear();
}