From 262e07b2866a9b1604df73c3db43a3c894ef48aa Mon Sep 17 00:00:00 2001 From: Baptiste Date: Tue, 14 Nov 2023 16:58:06 +0100 Subject: [PATCH] Ajout du renderer --- game.js | 7 +++++++ index.html | 5 +++-- render.js | 24 ++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 render.js diff --git a/game.js b/game.js index e69de29..af36d77 100644 --- a/game.js +++ b/game.js @@ -0,0 +1,7 @@ +setInterval(game); + +function game() { + Renderer = new Render("canvas") + + Renderer.AddPlayer(3, 5, ) +} \ No newline at end of file diff --git a/index.html b/index.html index 7f44a7f..06dd9c8 100644 --- a/index.html +++ b/index.html @@ -1,10 +1,11 @@ - + + - + diff --git a/render.js b/render.js new file mode 100644 index 0000000..cb32698 --- /dev/null +++ b/render.js @@ -0,0 +1,24 @@ +class Render { + constructor(id) { + this.canvas = document.getElementById(id) + this.ctx = canvas.getContext("2d") + + this.ReloadAff() + } + + ReloadAff() { + this.ctx.fillStyle = "red" + this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height); + /*this.ctx.stokeStyle = "black" + this.ctx.lineWidth = 1; + ctx.beginPath(); + ctx.moveTo(point1[0], point1[1]); + ctx.lineTo(point2[0], point2[1]); + ctx.lineTo(point3[0], point3[1]); + ctx.lineTo(point1[0], point1[1]); + ctx.stroke() + ctx.fill();*/ + this.ctx.closePath(); + this.ctx + } +} \ No newline at end of file