From fbb3e01b4a9e0edb09ab17e2494281ae4d13c16b Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 20 Jul 2018 17:47:11 +0200 Subject: [PATCH] Game - Fix Changing Canvas --- lib/game/Game.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/game/Game.dart b/lib/game/Game.dart index 72c474c..5ce7676 100644 --- a/lib/game/Game.dart +++ b/lib/game/Game.dart @@ -7,7 +7,6 @@ typedef void gridIterator(int x, int y); class Game { List> grid; CanvasElement canvas; - CanvasRenderingContext2D ctx; Random rng = new Random(); double _oscill = 0.1; @@ -17,7 +16,6 @@ class Game { Game(CanvasElement this.canvas) { grid = _buildGrid(5, 5, new Color(255, 0, 255)); - ctx = this.canvas.getContext('2d'); } // In-World Logic Updates @@ -28,6 +26,8 @@ class Game { // Render Pipeline void draw([num interp]) { + CanvasRenderingContext2D ctx = this.canvas.context2D; + int brickW = (canvas.width ~/ grid[0].length); int brickH = (canvas.height ~/ grid.length);