This commit is contained in:
kolaflash
2026-02-09 23:26:50 +01:00
parent fcc0f90198
commit f07dc0bf51
7 changed files with 211 additions and 13 deletions
+26
View File
@@ -0,0 +1,26 @@
import type { Vector } from "#/engine/Vector.ts";
export type Circle = {
position: Vector;
radius: number;
};
export function createCircle(position: Vector, radius: number): Circle {
return {
position,
radius,
};
}
export function drawCircle(
ctx: CanvasRenderingContext2D,
circle: Circle,
color: string = "#fff",
): void {
ctx.save();
ctx.strokeStyle = color;
ctx.beginPath();
ctx.arc(circle.position.x, circle.position.y, circle.radius, 0, 2 * Math.PI);
ctx.stroke();
ctx.restore();
}