1
0
Fork 0
tsgames/src/games/text-dungeon/drawable.ts

15 lines
268 B
TypeScript

export abstract class Drawable {
protected dirty: boolean = true;
abstract doDraw(): void;
draw() {
if (this.dirty) {
this.doDraw();
this.dirty = false;
}
}
invalidate() {
this.dirty = true;
}
}