🌖😅 Checkpoint
./renderer.js:9517054/1397
This commit is contained in:
parent
711c1864b2
commit
61c57697de
1 changed files with 33 additions and 0 deletions
33
renderer.js
Normal file
33
renderer.js
Normal 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) {}
|
||||
}
|
Loading…
Reference in a new issue