-
-
Save melcor76/0a36716c8e51e0a44d78b7388a62da70 to your computer and use it in GitHub Desktop.
js-tetris - get canvas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const canvas = document.getElementById('board'); | |
const ctx = canvas.getContext('2d'); | |
// Calculate size of canvas from constants. | |
ctx.canvas.width = COLS * BLOCK_SIZE; | |
ctx.canvas.height = ROWS * BLOCK_SIZE; | |
// Scale blocks | |
ctx.scale(BLOCK_SIZE, BLOCK_SIZE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment