dynamic rescalzing
This commit is contained in:
parent
31c4c21944
commit
da4f5afbe9
4 changed files with 31 additions and 37 deletions
|
@ -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(() => {
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue