diff --git a/frontend/index.html b/frontend/index.html index b2fd54e..edf326a 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -5,6 +5,7 @@ Chess + diff --git a/frontend/main.js b/frontend/main.js index 019c0f4..c17a262 100644 --- a/frontend/main.js +++ b/frontend/main.js @@ -1 +1,15 @@ -console.log("Hello World!"); +var _canvas = document.getElementById("chessBoard"); + +function drawChessBoard(canvas) { + let ctx = canvas.getContext("2d"); + let w = canvas.width; + let h = canvas.height; + ctx.fillStyle = '#c0c0c0'; + for (let r = 0; r < 8; r++) { + for (let c = 0; c < 8; c++) { + if ((r + c) % 2) ctx.fillRect(w/8*r, h/8*c, w/8, h/8); + } + } +} + +drawChessBoard(_canvas);