Sounds on the client

This commit is contained in:
2026-11-22 07:21:29 -03:00
parent f308ab52f1
commit 47934b272c
21 changed files with 1002 additions and 25 deletions
+4
View File
@@ -31,6 +31,8 @@ import { in_desktop_app, type JoinServer, TitleScreen } from "./gui/title_screen
import { MainMenuScreen } from "./gui/main_menu.ts";
import { DisconnectedScreen } from "./gui/disconnected_screen.ts";
import { profiler } from "./profiler.ts";
import { sounds } from "./sounds.ts";
import { WebAudioOutput } from "./audio_output.ts";
// runs whatever is showing every frame: a menu screen before joining (and after leaving), or the game
export // while playing, the browser asks before leaving the page. sprinting is ctrl and walking is w, and ctrl+w closes the
@@ -231,6 +233,8 @@ try {
}
InputManager.initialize(game_canvas);
// waits for the first click or key, which the title screen gets
sounds.set_output(new WebAudioOutput());
self.addEventListener("resize", resize_canvas);
resize_canvas();
canvas.addEventListener("contextmenu", (event) => event.preventDefault());