Add width/height to textdisplaysystem
This commit is contained in:
parent
5796f914e3
commit
17e34d5ba2
|
|
@ -8,9 +8,11 @@ import { Resources } from "@common/rpg/utils/resources";
|
|||
export class TextDisplaySystem extends System {
|
||||
public readonly display: TextDisplay;
|
||||
|
||||
constructor(display?: TextDisplay) {
|
||||
constructor(display: TextDisplay);
|
||||
constructor(width?: number, height?: number);
|
||||
constructor(displayOrWidth?: TextDisplay | number, height?: number) {
|
||||
super();
|
||||
this.display = display ?? new TextDisplay();
|
||||
this.display = displayOrWidth instanceof TextDisplay ? displayOrWidth : new TextDisplay(displayOrWidth, height);
|
||||
}
|
||||
|
||||
override update(world: World) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ function createMap(world: World, random: SeededRandom) {
|
|||
|
||||
export default gameLoop(() => {
|
||||
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 map = createMap(world, random);
|
||||
|
|
|
|||
Loading…
Reference in New Issue