diff options
Diffstat (limited to 'test-client/visual.ts')
| -rw-r--r-- | test-client/visual.ts | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test-client/visual.ts b/test-client/visual.ts index 20bd7ae2..c06edff0 100644 --- a/test-client/visual.ts +++ b/test-client/visual.ts @@ -101,16 +101,28 @@ export function draw_ingame() { function draw_debug_events() { for (const ev of debug_events.values()) { + const color = `rgb(${ev.color[0] * 100}%,${ev.color[1] * 100}%,${ev.color[2] * 100}%)` if (ev.display.ty == "path") { ctx.lineWidth = 0.1 ctx.lineCap = "round" - ctx.strokeStyle = `rgb(${ev.color[0] * 100}%,${ev.color[1] * 100}%,${ev.color[2] * 100}%)` + ctx.strokeStyle = color ctx.beginPath() if (ev.display.points.length) ctx.moveTo(...ev.display.points[0]) for (let i = 1; i < ev.display.points.length; i++) ctx.lineTo(...ev.display.points[i]) ctx.stroke() + } else if (ev.display.ty == "label") { + ctx.font = "0.2px sans-serif" + ctx.strokeStyle = "black" + ctx.fillStyle = color + ctx.lineWidth = 0.1 + ctx.textAlign = "center" + ctx.textBaseline = "middle" + ctx.lineJoin = "round" + ctx.lineCap = "round" + ctx.strokeText(ev.display.text, ev.display.pos[0], ev.display.pos[1]) + ctx.fillText(ev.display.text, ev.display.pos[0], ev.display.pos[1]) } } } |