'use strict'

modules['debugText'] = {
    config: [
        ['position', 'float2', [10, 10]],
        ['text', 'string', 'xxx'],
    ],

    render: async (time, self, config) => {
        if (showDebugInfo) {
            const {
                position,
                text,
            } = { ...config }
            
            ctx.globalAlpha = 1.0
            ctx.globalCompositeOperation = 'source-over'
            ctx.font = 'bold 32px sans-serif'
            ctx.textAlign = 'start'
            ctx.textBaseline = 'top'
            ctx.strokeStyle = '#000'
            ctx.strokeText(text, position[0], position[1])
            ctx.fillStyle = '#fff'
            ctx.lineWidth = 8
            ctx.fillText(text, position[0], position[1])
        }
    }
}
