public/js/render/fx.js becomes a re-export barrel. Speeds, camera heights, fonts, the kind table and the shared tunables move verbatim into public/js/render/fx/*.js. FxSystem keeps its constructor, clear, update, counts and destroy; the other methods move verbatim into container classes installed on FxSystem.prototype in source order. simSpeeds and fontsReady each stay one instance. The dynamic import of /sim/constants.js stays next to setSimProjectileSpeeds.
22 lines
945 B
JavaScript
22 lines
945 B
JavaScript
// public/js/render/fx/fonts.js — damage-number bitmap fonts (one module-level ready flag).
|
||
|
||
import { DMG_STYLE } from '../style.js';
|
||
|
||
let fontsReady = false;
|
||
|
||
/** Generate the damage-number bitmap fonts (after web fonts loaded, if possible). */
|
||
export function ensureDamageFonts() {
|
||
if (fontsReady) return;
|
||
const P = globalThis.PIXI;
|
||
for (const st of Object.values(DMG_STYLE)) {
|
||
try {
|
||
P.BitmapFont.from(st.font, {
|
||
fontFamily: ['Bender', 'Oxanium', 'Rajdhani', 'Arial Black', 'sans-serif'], fontSize: 44, fontWeight: '700',
|
||
fill: st.fill, fillGradientStops: [0.25, 1], stroke: st.stroke, strokeThickness: 7,
|
||
dropShadow: true, dropShadowColor: '#000000', dropShadowAlpha: 0.45, dropShadowDistance: 2, dropShadowBlur: 2,
|
||
}, { chars: [['0', '9'], '+-×!'], resolution: 2, padding: 6 });
|
||
} catch (err) { console.warn('[fx] bitmap font', st.font, err?.message || err); }
|
||
}
|
||
fontsReady = true;
|
||
}
|