[core] add meta mobileWidth and mobileHeight params

This commit is contained in:
2019-08-27 17:30:32 +03:00
parent bd4fc36ff1
commit 35a9074d6c
6 changed files with 50 additions and 7 deletions

View File

@@ -42,10 +42,13 @@ class Config {
company: null,
width: 800,
height: 600,
mobileWidth: null,
mobileHeight: null,
fps: 60,
};
if (params) {
this.update(params);
this.afterUpdate();
}
}
@@ -68,12 +71,18 @@ class Config {
if (this.meta.icon) this.icon = Config.absolutePath(this.meta.icon);
}
afterUpdate() {
if (this.meta.mobileWidth === null) this.meta.mobileWidth = this.meta.width;
if (this.meta.mobileHeight === null) this.meta.mobileHeight = Math.round(this.meta.mobileWidth / 1.777777778);
}
branch(params) {
const result = new Config();
for (const params of this._params) {
result.update(params);
}
result.update(params);
result.afterUpdate();
return result;
}
}