get rid of react

This commit is contained in:
nora 2023-02-08 21:52:51 +01:00
parent 6029115be5
commit 6d85b2e5dd
39 changed files with 806 additions and 11491 deletions

39
src/Shapes.ts Normal file
View file

@ -0,0 +1,39 @@
import { Ctx, FillStyle } from "./MainDraw.js";
export function rect(
ctx: Ctx,
x: number,
y: number,
w: number,
h: number,
color: FillStyle = "black"
): void {
ctx.fillStyle = color;
ctx.fillRect(x, y, w, h);
}
export function circle(
ctx: Ctx,
x: number,
y: number,
r: number,
color: FillStyle = "black"
): void {
ctx.fillStyle = color;
ctx.beginPath();
ctx.ellipse(x, y, r, r, 0, 0, 50);
ctx.fill();
}
export function text(
ctx: Ctx,
x: number,
y: number,
text: string,
fontSize: number = 15,
color: FillStyle = "black"
) {
ctx.fillStyle = color;
ctx.font = `${fontSize}px Arial`;
ctx.fillText(text, x, y);
}