diff options
author | elioat <{ID}+{username}@users.noreply.github.com> | 2024-12-27 10:54:27 -0500 |
---|---|---|
committer | elioat <{ID}+{username}@users.noreply.github.com> | 2024-12-27 10:54:27 -0500 |
commit | d17d85553a72e40ac390238dab5c03dfa9f567ee (patch) | |
tree | 896e1be92e1fe21b17d6a30cd1c0dfb5375e6224 /html/rogue/js/state.js | |
parent | 93af36423b2a1415c89ab7adb92ee458d4ae5a46 (diff) | |
download | tour-d17d85553a72e40ac390238dab5c03dfa9f567ee.tar.gz |
*
Diffstat (limited to 'html/rogue/js/state.js')
-rw-r--r-- | html/rogue/js/state.js | 17 |
1 files changed, 17 insertions, 0 deletions
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 |