27 lines
579 B
JavaScript
27 lines
579 B
JavaScript
import { Pointer } from './pointer.js';
|
|
|
|
export class Scene {
|
|
constructor(width, height) {
|
|
this.init(width, height);
|
|
}
|
|
|
|
init = async (width, height) => {
|
|
this.canvas = document.querySelector('canvas');
|
|
this.context = this.canvas.getContext('2d');
|
|
|
|
this.setScreenSize(width, height);
|
|
}
|
|
|
|
run() {
|
|
// clear canvas
|
|
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
this.context.fillRect(0, 0, 100, 100);
|
|
// console.log(Pointer.pos);
|
|
}
|
|
|
|
setScreenSize(w, h) {
|
|
this.canvas.width = w;
|
|
this.canvas.height = h;
|
|
}
|
|
}
|