import {game} from "../game/game.js" export var canvas = document.getElementById('canvas'); export var ctx = canvas.getContext('2d'); export var wrapper = document.getElementById('game'); export var rightBar = document.getElementById('rightBar'); export var leftBar = document.getElementById('leftBar'); canvas.width = game.tileSize*game.gridSize[0]; canvas.height = game.tileSize*game.gridSize[1]; scaleEverythingGood() window.addEventListener('resize', scaleEverythingGood); function scaleEverythingGood() { const width = window.innerWidth-2; const height = window.innerHeight-2; let canvasWidth if (canvas.width > canvas.height) { canvasWidth = Math.max(width, height) } else { canvasWidth = width } canvasWidth = canvasWidth/4 canvas.style.width = `${canvasWidth}px`; rightBar.style.width = `${canvasWidth}px` leftBar.style.width = `${canvasWidth/2}px` const wrapperWidth = rightBar.style.width + leftBar.style.width; wrapper.style.width = `${wrapperWidth}px` wrapper.style.height = `${height}px` }