Remove duplicate code

This commit is contained in:
2026-10-13 11:57:43 -03:00
parent dfc6a6d77b
commit 5165698fe3
50 changed files with 307 additions and 812 deletions
+3 -9
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import { AssetManager } from "../assets.ts";
import { flush_batch, get_current_texture, push_quad, set_current_texture } from "./core.ts";
import { push_quad, use_texture } from "./core.ts";
import { type Plane3d, push_plane_quad } from "./shapes.ts";
import { FntChar, FntFont, Texture } from "./types.ts";
@@ -79,10 +79,7 @@ export function draw_text(str: string, x: number, y: number, scale: number = 1,
return;
}
if (get_current_texture() !== font_texture.tex) {
flush_batch();
set_current_texture(font_texture.tex);
}
use_texture(font_texture.tex);
for (const ch of str) {
const glyph = font_fnt.chars[ch.charCodeAt(0)];
@@ -120,10 +117,7 @@ export function draw_text_3d(
return;
}
if (get_current_texture() !== font_texture.tex) {
flush_batch();
set_current_texture(font_texture.tex);
}
use_texture(font_texture.tex);
for (const ch of str) {
const glyph = font_fnt.chars[ch.charCodeAt(0)];