No more ecs

This commit is contained in:
2026-09-25 16:05:25 -03:00
parent 4539898c58
commit 213363d0be
56 changed files with 1103 additions and 1644 deletions
+10 -10
View File
@@ -1,5 +1,5 @@
import { AssetManager } from "./assets.ts";
import { ClientWorld } from "./client_world.ts";
import { Client } from "./client.ts";
import { InputManager } from "./input_manager.ts";
import { Connection, get_player_name } from "./network.ts";
import { connect, HandshakeError, is_trusted, join, load_atlas, remember_trust, server_address } from "./handshake.ts";
@@ -7,18 +7,18 @@ import { confirm_mods } from "./confirm_mods.ts";
import { ModLoadError } from "$/common/mod_loader.ts";
import { begin_drawing, clear_background, end_drawing, init_font, init_window, load_texture } from "./renderer/mod.ts";
import { is_stopped, show_fatal_error } from "./fatal.ts";
import { load_client_mods, set_mods_world } from "./mods.ts";
import { load_client_mods, set_mods_client } from "./mods.ts";
export class ClientLoop {
running = false;
last_time = 0;
world: ClientWorld;
client: Client;
frame_count = 0;
last_fps_time = 0;
constructor(world: ClientWorld) {
this.world = world;
constructor(client: Client) {
this.client = client;
}
start() {
@@ -49,7 +49,7 @@ export class ClientLoop {
begin_drawing();
clear_background(0.69, 0.8, 1, 1.0);
this.world.update(delta);
this.client.run_frame(delta);
end_drawing();
this.frame_count += 1;
@@ -121,11 +121,11 @@ async function join_server(): Promise<Connection> {
try {
const connection = await join_server();
const client_world = new ClientWorld(connection);
set_mods_world(client_world);
client_world.add_chat("Connected to the server");
const client = new Client(connection);
set_mods_client(client);
client.chat.add("Connected to the server");
const loop = new ClientLoop(client_world);
const loop = new ClientLoop(client);
loop.start();
console.log("Game started");