Ajout du renderer
This commit is contained in:
parent
33f9086c43
commit
262e07b286
3 changed files with 34 additions and 2 deletions
7
game.js
7
game.js
|
@ -0,0 +1,7 @@
|
|||
setInterval(game);
|
||||
|
||||
function game() {
|
||||
Renderer = new Render("canvas")
|
||||
|
||||
Renderer.AddPlayer(3, 5, )
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
<script type="text/javascipt" src="./game.js" defer></script>
|
||||
<script type="text/javascript" src="render.js" defer></script>
|
||||
<script type="text/javascript" src="game.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas width="800" height="800" id="Canvas" style="border: 1px;"></canvas>
|
||||
<canvas width="800" height="800" id="canvas" style="border: 1px;"></canvas>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
24
render.js
Normal file
24
render.js
Normal file
|
@ -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
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue