From 9afbd3c680bd8da88fd812be3e0cce79eb45153e Mon Sep 17 00:00:00 2001 From: Francois Date: Sat, 14 Oct 2023 21:45:09 -0400 Subject: [PATCH] Added start of debugrender functions. Not finished/not hooked up --- src/renderer/DebugRenderer.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/renderer/DebugRenderer.ts diff --git a/src/renderer/DebugRenderer.ts b/src/renderer/DebugRenderer.ts new file mode 100644 index 0000000..9aa843a --- /dev/null +++ b/src/renderer/DebugRenderer.ts @@ -0,0 +1,19 @@ +import { Color, ColorToCSS } from "../colors/Color"; + +export function DebugLine2D( + svg: SVGElement, + x: number, + y: number, + x2: number, + y2: number, + stroke: Color = Color(0, 0, 0) +) { + const line = document.createElementNS("http://www.w3.org/2000/svg", "line"); + line.setAttribute("x1", x.toFixed(2)); + line.setAttribute("y1", y.toFixed(2)); + line.setAttribute("x2", x2.toFixed(2)); + line.setAttribute("y2", y2.toFixed(2)); + line.setAttribute("stroke", ColorToCSS(stroke)); + // line.setAttribute("stroke-width", "0.1"); + svg.appendChild(line); +}