From d17d85553a72e40ac390238dab5c03dfa9f567ee Mon Sep 17 00:00:00 2001 From: elioat <{ID}+{username}@users.noreply.github.com> Date: Fri, 27 Dec 2024 10:54:27 -0500 Subject: * --- html/rogue/js/state.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 html/rogue/js/state.js (limited to 'html/rogue/js/state.js') diff --git a/html/rogue/js/state.js b/html/rogue/js/state.js new file mode 100644 index 0000000..f5c713d --- /dev/null +++ b/html/rogue/js/state.js @@ -0,0 +1,17 @@ +const GameState = { + canvas: null, + ctx: null, + lastFrameTime: 0, + + init() { + this.canvas = document.getElementById('gameCanvas'); + this.ctx = this.canvas.getContext('2d'); + this.lastFrameTime = 0; + }, + + resize() { + this.canvas.width = window.innerWidth; + this.canvas.height = window.innerHeight; + Camera.centerOn(player.position); + } +}; \ No newline at end of file -- cgit 1.4.1-2-gfad0