From e652dfba1f2b0c4d0235f98a0a657b40bc3fc18a Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sun, 23 Apr 2023 18:55:22 +0300 Subject: [PATCH] clean old draw code --- src/js/scene.js | 59 ------------------------------------------------- 1 file changed, 59 deletions(-) diff --git a/src/js/scene.js b/src/js/scene.js index 8bd9556..4f057e6 100644 --- a/src/js/scene.js +++ b/src/js/scene.js @@ -14,80 +14,21 @@ export class Scene { } run() { - this.#update(); - this.#draw(); - } - - #update() { - // read layers & draw items this.#layers.forEach((layer) => { layer.objects().forEach((item) => { if (typeof item.ticker == 'function') { item.ticker(); } - }); - }); - } - #draw() { - // read layers & draw items - this.#layers.forEach((layer) => { - layer.objects().forEach((item) => { if (typeof item.draw == 'function') { item.draw(this.#context, true); } else { console.log(`⛔ Error display '${item.constructor.name}' object.`); } - - // switch (item.constructor.name) { - // case 'Rect': - // this.#drawRect(item.x, item.y, item.width, item.height, item.fillColor); - // break; - - // case 'StrokeRect': - // this.#drawStrokeRect( - // item.x, - // item.y, - // item.width, - // item.height, - // item.fillColor, - // item.strokeColor, - // item.strokeWidth - // ); - // break; - - // case 'Sprite': - // this.#drawSprite(item); - // break; - - // default: - // console.log(`⛔ Error display '${item.constructor.name}' object.`); - // } }); }); } - // #drawRect(x, y, w, h, fillColor) { - // this.#context.fillStyle = fillColor; - // this.#context.fillRect(x, y, w, h); - // } - - // #drawStrokeRect(x, y, w, h, fillColor, strokeColor, strokeWidth) { - // this.#drawRect(x, y, w, h, fillColor); - - // this.#context.lineWidth = strokeWidth; - // this.#context.strokeStyle = strokeColor; - // this.#context.strokeRect(x, y, w, h); - // } - - // #drawSprite(image) { - // if (image.loaded != true) { - // return -1; - // } - - // this.#context.drawImage(image.image(), image.x, image.y); - // } - addLayer(layer) { this.#layers.push(layer); }