MCPcopy Index your code
hub / github.com/KilledByAPixel/LittleJS / drawLine

Method drawLine

plugins/uiSystem.js:368–382  ·  view source on GitHub ↗

Draw a line to the UI context * @param {Vector2} posA * @param {Vector2} posB * @param {number} [lineWidth=uiSystem.defaultLineWidth] * @param {Color} [lineColor=uiSystem.defaultLineColor]

(posA, posB, lineWidth=uiSystem.defaultLineWidth, lineColor=uiSystem.defaultLineColor)

Source from the content-addressed store, hash-verified

366 * @param {number} [lineWidth=uiSystem.defaultLineWidth]
367 * @param {Color} [lineColor=uiSystem.defaultLineColor] */
368 drawLine(posA, posB, lineWidth=uiSystem.defaultLineWidth, lineColor=uiSystem.defaultLineColor)
369 {
370 ASSERT(isVector2(posA), 'posA must be a vec2');
371 ASSERT(isVector2(posB), 'posB must be a vec2');
372 ASSERT(isNumber(lineWidth), 'lineWidth must be a number');
373 ASSERT(isColor(lineColor), 'lineColor must be a color');
374
375 const context = uiSystem.uiContext;
376 context.strokeStyle = lineColor.toString();
377 context.lineWidth = lineWidth;
378 context.beginPath();
379 context.lineTo(posA.x, posA.y);
380 context.lineTo(posB.x, posB.y);
381 context.stroke();
382 }
383
384 /** Draw a tile to the UI context
385 * @param {Vector2} pos

Callers 6

renderMethod · 0.80
gameRenderFunction · 0.80
gameRenderPostFunction · 0.80
renderMethod · 0.80
renderMethod · 0.80
renderMethod · 0.80

Calls 5

isVector2Function · 0.85
isNumberFunction · 0.85
isColorFunction · 0.85
ASSERTFunction · 0.50
toStringMethod · 0.45

Tested by

no test coverage detected