y.o.y. did u define resizeCanvas in the long-ass end-of-loading function

This commit is contained in:
An Orbit 2024-01-02 23:34:49 -05:00 committed by GitHub
parent d89cf82b79
commit 9cb8c52029
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -2193,6 +2193,20 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
//ENABLE RUNNING CODE AFTER STATE ELEMENT AUTOGENERATION (runAfterAutogen) ##
resizeCanvas = function(newHeight,newWidth,newPixelSize,clear) {
var gameCanvas = document.getElementById("game");
var ctx = gameCanvas.getContext("2d");
ctx.canvas.width = newWidth;
ctx.canvas.height = newHeight;
document.getElementById("gameDiv").style.width = newWidth + "px";
pixelSize = newPixelSize;
pixelSizeHalf = newPixelSize/2;
height = Math.round(newHeight/newPixelSize)-1;
width = Math.round(newWidth/newPixelSize)-1;
mousePos = {x:width/2,y:height/2};
if (clear!==false) { clearAll(); }
}
function runAfterAutogen(func) {
runAfterAutogenList.push(func);
};