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)
| 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 |