feedback5 R5: split the battle effect system into modules
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.
This commit is contained in:
1 parent
eb04f5dfa4
commit
c1b8292f92
16 files changed
+2385
-2224
No files matched your search
@@ -0,0 +1,21 @@
|
||||
// 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;
|
||||
}
|
||||
Reference in new issue
Block a user