mirror of
https://github.com/Noratrieb/redox.git
synced 2026-01-14 16:25:04 +01:00
get rid of react
This commit is contained in:
parent
6029115be5
commit
6d85b2e5dd
39 changed files with 806 additions and 11491 deletions
39
src/Shapes.ts
Normal file
39
src/Shapes.ts
Normal 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue