export abstract class Drawable {
    protected dirty: boolean = true;
    abstract doDraw(): void;

    draw() {
        if (this.dirty) {
            this.doDraw();
            this.dirty = false;
        }
    }

    invalidate() {
        this.dirty = true;
    }
}