@kubixiake 写道:
效果如上面!代码
drawGrid:function(node,width,height,col,row,lineColor){
var g=node.getComponent(cc.Graphics)
g.clear();
var colSpacing =width/col;
var rowSpacing=height/row;for (var i=0;i<col+1;i++){ g.strokeColor = lineColor; g.fillColor = lineColor; g.moveTo(i*colSpacing,0); g.lineTo(i*colSpacing,-height); g.stroke(); } for (var i=0;i<row+1;i++){ g.strokeColor = lineColor; g.fillColor = lineColor; g.moveTo(0,-i* rowSpacing); g.lineTo(width,-i* rowSpacing); g.stroke(); } }
在PC浏览器上面没问题!
帖子: 6
参与者: 1