From 3abb79af8334bdf4ff21708d6605e8f9e73e243f Mon Sep 17 00:00:00 2001 From: Bill Rossi Date: Sun, 1 Jun 2025 15:30:12 -0400 Subject: [PATCH] Initial commit --- index.html | 12 ++++++++++++ src/game.js | 16 ++++++++++++++++ src/index.js | 8 ++++++++ 3 files changed, 36 insertions(+) create mode 100644 index.html create mode 100644 src/game.js create mode 100644 src/index.js diff --git a/index.html b/index.html new file mode 100644 index 0000000..1b5908c --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ + + + + Zelder + + + + + You need a better browser to play this game. + + + diff --git a/src/game.js b/src/game.js new file mode 100644 index 0000000..37715b8 --- /dev/null +++ b/src/game.js @@ -0,0 +1,16 @@ +export default class Game { + constructor(canvas) { + this.canvas = canvas + this.ctx = canvas.getContext("2d") + } + + draw() { + const { canvas, ctx } = this + ctx.clearRect(0, 0, canvas.width, canvas.height) + ctx.beginPath() + ctx.fillColor = "#FF0000" + ctx.rect(200, 100, 80, 50) + ctx.fill() + ctx.closePath() + } +} diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..a800229 --- /dev/null +++ b/src/index.js @@ -0,0 +1,8 @@ +import Game from "./game.js" + +document.addEventListener("DOMContentLoaded", e => { + console.log("Hello, world!") + const canvas = document.getElementById("game-canvas") + const game = new Game(canvas) + game.draw() +})