Change run key to ctrl and some other messy stuff to make that work,,
This commit is contained in:
+9
-1
@@ -23,7 +23,13 @@ import { TitleScreen } from "./gui/title_screen.ts";
|
||||
import { DisconnectedScreen } from "./gui/disconnected_screen.ts";
|
||||
|
||||
// runs whatever is showing every frame: a menu screen before joining (and after leaving), or the game
|
||||
export class ClientLoop {
|
||||
export // while playing, the browser asks before leaving the page. sprinting is ctrl and walking is w, and ctrl+w closes the
|
||||
// tab without the page getting a say. in fullscreen the keyboard lock catches it instead (see input_manager.ts)
|
||||
function confirm_leaving(confirm: boolean) {
|
||||
self.onbeforeunload = confirm ? (event) => event.preventDefault() : null;
|
||||
}
|
||||
|
||||
class ClientLoop {
|
||||
running = false;
|
||||
last_time = 0;
|
||||
client: Client | undefined;
|
||||
@@ -54,6 +60,7 @@ export class ClientLoop {
|
||||
show_screen(screen: GuiScreen) {
|
||||
this.screen?.on_close();
|
||||
this.client = undefined;
|
||||
confirm_leaving(false);
|
||||
this.screen = screen;
|
||||
InputManager.set_mouse_grabbed(false);
|
||||
}
|
||||
@@ -65,6 +72,7 @@ export class ClientLoop {
|
||||
this.screen?.on_close();
|
||||
this.screen = undefined;
|
||||
this.client = client;
|
||||
confirm_leaving(true);
|
||||
console.log("Game started");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user