about summary refs log tree commit diff stats
path: root/html/rogue/js/state.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/rogue/js/state.js')
-rw-r--r--html/rogue/js/state.js17
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