import font from '../cgt/font'

export default class Dialog {

    constructor(data) {
        this.data = data

        this.options = []
    }

    draw(ctx) {
        this.data.forEach((item, i) => {
            if (item.type === 'msg') {
                const p = item.position
                const skip = this.options[i] ? this.options[i].skip : 0
                font.drawText(ctx, item.text, p.x, p.y, p.w, p.h, 10, skip)
            }
        })
    }

    update(dt, keys) {

    }

    static simpleMsg(text) {
        return {
            type: 'msg',
            text,
            position: { x: 0, y: 0, w: 0, h: 0 }
        }
    }

}
