Game - Fix Changing Canvas

This commit is contained in:
Marty Oehme 2018-07-20 17:47:11 +02:00
parent bc02cf6382
commit fbb3e01b4a
1 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,6 @@ typedef void gridIterator(int x, int y);
class Game {
List<List<Color>> 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);