Game - Fix Changing Canvas
This commit is contained in:
parent
bc02cf6382
commit
fbb3e01b4a
1 changed files with 2 additions and 2 deletions
|
@ -7,7 +7,6 @@ typedef void gridIterator(int x, int y);
|
||||||
class Game {
|
class Game {
|
||||||
List<List<Color>> grid;
|
List<List<Color>> grid;
|
||||||
CanvasElement canvas;
|
CanvasElement canvas;
|
||||||
CanvasRenderingContext2D ctx;
|
|
||||||
Random rng = new Random();
|
Random rng = new Random();
|
||||||
|
|
||||||
double _oscill = 0.1;
|
double _oscill = 0.1;
|
||||||
|
@ -17,7 +16,6 @@ class Game {
|
||||||
|
|
||||||
Game(CanvasElement this.canvas) {
|
Game(CanvasElement this.canvas) {
|
||||||
grid = _buildGrid(5, 5, new Color(255, 0, 255));
|
grid = _buildGrid(5, 5, new Color(255, 0, 255));
|
||||||
ctx = this.canvas.getContext('2d');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// In-World Logic Updates
|
// In-World Logic Updates
|
||||||
|
@ -28,6 +26,8 @@ class Game {
|
||||||
|
|
||||||
// Render Pipeline
|
// Render Pipeline
|
||||||
void draw([num interp]) {
|
void draw([num interp]) {
|
||||||
|
CanvasRenderingContext2D ctx = this.canvas.context2D;
|
||||||
|
|
||||||
int brickW = (canvas.width ~/ grid[0].length);
|
int brickW = (canvas.width ~/ grid[0].length);
|
||||||
int brickH = (canvas.height ~/ grid.length);
|
int brickH = (canvas.height ~/ grid.length);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue