aboutsummaryrefslogtreecommitdiff
path: root/test-client/visual.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-10-21 00:18:09 +0200
committermetamuffin <metamuffin@disroot.org>2025-10-21 00:18:11 +0200
commitb34b2a5b8d118974502c015912e1ed67fa6965b0 (patch)
treefd9aae3af50fc6e312e64934b9231f59142210ee /test-client/visual.ts
parenteaed442578c3b1765ec48c84489a122096b6a08f (diff)
downloadhurrycurry-b34b2a5b8d118974502c015912e1ed67fa6965b0.tar
hurrycurry-b34b2a5b8d118974502c015912e1ed67fa6965b0.tar.bz2
hurrycurry-b34b2a5b8d118974502c015912e1ed67fa6965b0.tar.zst
more debug events, bots now broken
Diffstat (limited to 'test-client/visual.ts')
-rw-r--r--test-client/visual.ts14
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])
}
}
}