1
0
Fork 0

Add width/height to textdisplaysystem

This commit is contained in:
Pabloader 2026-05-05 09:14:32 +00:00
parent 5796f914e3
commit 17e34d5ba2
2 changed files with 5 additions and 3 deletions

View File

@ -8,9 +8,11 @@ import { Resources } from "@common/rpg/utils/resources";
export class TextDisplaySystem extends System { export class TextDisplaySystem extends System {
public readonly display: TextDisplay; public readonly display: TextDisplay;
constructor(display?: TextDisplay) { constructor(display: TextDisplay);
constructor(width?: number, height?: number);
constructor(displayOrWidth?: TextDisplay | number, height?: number) {
super(); super();
this.display = display ?? new TextDisplay(); this.display = displayOrWidth instanceof TextDisplay ? displayOrWidth : new TextDisplay(displayOrWidth, height);
} }
override update(world: World) { override update(world: World) {

View File

@ -36,7 +36,7 @@ function createMap(world: World, random: SeededRandom) {
export default gameLoop(() => { export default gameLoop(() => {
const world = new World(); const world = new World();
const display = world.addSystem(new TextDisplaySystem()).display; const display = world.addSystem(new TextDisplaySystem(100, 25)).display;
const random = new SeededRandom('awoorwa'); const random = new SeededRandom('awoorwa');
const map = createMap(world, random); const map = createMap(world, random);