给文字添加下划线,其实也就是画一条直线,只是直线放在了文字下方而已
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
function display.newLine(points, params) local radius local borderColor local scale
if not params then borderColor = cc.c4f(0,0,0,1) radius = 0.5 scale = 1.0 else borderColor = params.borderColor or cc.c4f(0,0,0,1) radius = (params.borderWidth and params.borderWidth/2) or 0.5 scale = checknumber(params.scale or 1.0) end
for i, p in ipairs(points) do p = cc.p(p[1] * scale, p[2] * scale) points[i] = p end
local drawNode = cc.DrawNode:create() drawNode:drawSegment(points[1], points[2], radius, borderColor)
return drawNode end
|