dynamic rescalzing

This commit is contained in:
biglyderv 2025-05-16 14:09:50 -04:00
parent 31c4c21944
commit da4f5afbe9
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
4 changed files with 31 additions and 37 deletions

View file

@ -83,12 +83,6 @@ Canvas.prototype.resize = function () {
this.elem.width = this.width;
this.elem.height = this.height;
if(document.querySelector("#game") !== null)
document.querySelector("#game").setAttribute("style", `
width: ${this.width * this.upscale}px;
height: ${this.height * this.upscale}px;
`);
this.render();
}
@ -221,7 +215,7 @@ Canvas.prototype.click = function () {
this.firstY = this.pageY;
}
var canvas = new Canvas(240, 135, 4);
var canvas = new Canvas(Math.floor(window.innerWidth / 4.5), Math.floor(window.innerHeight / 6.5), 4);
var handler = new TickHandler(canvas);
setInterval(() => {

View file

@ -81,7 +81,7 @@ TileManager.prototype.loadSet = function (namespace, tiles) {
this.row2.appendChild(elem2);
elem.onclick = function (e) {
document.querySelectorAll("#game .selected-group").forEach(function (e) { e.classList.remove("selected-group") })
document.querySelectorAll(".selected-group").forEach(function (e) { e.classList.remove("selected-group") })
e.target.classList.add("selected-group");
elem2.classList.add("selected-group");
}