cc.Class({
    extends: cc.Component,

    properties: {
        
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.ctx = this.node.getComponent(cc.Graphics);
    },

    setBrushPos (x, y) {
        // 设置画笔起始位置
        this.ctx.moveTo(x, y);
    },

    setBrushLineWidth(lineWidth) {
        // 设置画笔粗细
        this.ctx.lineWidth = lineWidth;
    },

    setBrushColor(color) {
        // 设置画笔颜色(包括边框颜色和填充颜色)
        this.ctx.strokeColor = color;
        this.ctx.fillColor = color;
    },

    drawTo (x, y) {
        // 从起始位置一直画到目标位置
        this.ctx.lineTo(x, y);
        this.ctx.stroke();
    }

    // update (dt) {},
});
