Rendering performace on F3

This commit is contained in:
2026-10-02 21:21:19 -03:00
parent 1511338a23
commit dcaf878254
9 changed files with 426 additions and 53 deletions
+5 -2
View File
@@ -22,6 +22,7 @@ import { download_mods, load_client_mods, set_mods_client } from "./mods.ts";
import type { GuiScreen } from "./gui/gui_screen.ts";
import { TitleScreen } from "./gui/title_screen.ts";
import { DisconnectedScreen } from "./gui/disconnected_screen.ts";
import { profiler } from "./profiler.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
@@ -84,7 +85,8 @@ class ClientLoop {
const delta = (time - this.last_time) / 1000;
begin_drawing();
profiler.begin_frame();
profiler.section("begin frame", begin_drawing);
clear_background(0.69, 0.8, 1, 1.0);
if (this.client) {
this.client.run_frame(delta);
@@ -92,7 +94,8 @@ class ClientLoop {
this.screen.on_tick(delta);
this.screen.on_render();
}
end_drawing();
profiler.section("submit", end_drawing);
profiler.end_frame();
this.frame_count += 1;
const now = performance.now();