🌖😅 Checkpoint

./renderer.js:9517054/1397
This commit is contained in:
Glitch (glitch-hello-website) 2022-03-03 18:27:21 +00:00
parent 711c1864b2
commit 61c57697de

33
renderer.js Normal file
View file

@ -0,0 +1,33 @@
export default class {
constructor(canvas) {
this.canvas = canvas;
this.ctx = canvas.getContext("2d");
this.size = [0, 0];
this.camera = [0, 0];
this.zoom = 1;
}
clear() {
this.ctx.clearRect(0, 0, this.size[0], this.size[1]);
}
resize(w, h) {
const { canvas, ctx } = this;
canvas.width = w;
canvas.height = h;
ctx.width = w;
ctx.height = h;
this.size = [w, h];
}
rect(x, y, w, h) {
const { size, camera, zoom } = this;
}
circle(x, y, r) {}
color(c) {}
line(x1, y1, x2, y2) {}
}