example scene
This commit is contained in:
parent
b23a0fc187
commit
9b8a7575c2
@ -3,8 +3,6 @@ import { Settings } from './settings.js';
|
||||
import { Pointer } from './pointer.js';
|
||||
|
||||
export class App {
|
||||
|
||||
|
||||
constructor(w, h) {
|
||||
this.scene = new Scene(w, h);
|
||||
this.prevTime = Date.now();
|
||||
|
@ -15,8 +15,19 @@ export class Scene {
|
||||
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);
|
||||
|
||||
// fill canvas
|
||||
this.context.fillStyle = '#523c4e';
|
||||
this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
||||
|
||||
// draw border
|
||||
this.context.strokeStyle = '#8bd0ba';
|
||||
this.context.lineWidth = 1;
|
||||
this.context.strokeRect(5, 5, this.canvas.width - 10, this.canvas.height - 10);
|
||||
|
||||
// draw rect in center
|
||||
this.context.fillStyle = '#d44e52';
|
||||
this.context.fillRect(this.canvas.width / 2 - 50, this.canvas.height / 2 - 50, 100, 100);
|
||||
}
|
||||
|
||||
setScreenSize(w, h) {
|
||||
|
Loading…
Reference in New Issue
Block a user