Remove duplicate code
This commit is contained in:
@@ -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)];
|
||||
|
||||
Reference in New Issue
Block a user