mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2024-09-20 02:46:23 +00:00
Add background image option
This commit is contained in:
parent
73301c2ae9
commit
8c767b7351
2 changed files with 13 additions and 0 deletions
|
@ -189,6 +189,18 @@ class EmulatorJS {
|
|||
}
|
||||
|
||||
this.game.classList.add("ejs_game");
|
||||
if (typeof this.config.backgroundImg === "string") {
|
||||
this.game.style["background-image"] = "url('"+this.config.backgroundImg+"')";
|
||||
this.game.style["background-size"] = "contain";
|
||||
this.game.style["background-position"] = "center";
|
||||
this.game.style["background-repeat"] = "no-repeat";
|
||||
this.on("start", () => {
|
||||
this.game.style["background-image"] = "";
|
||||
this.game.style["background-size"] = "";
|
||||
this.game.style["background-position"] = "";
|
||||
this.game.style["background-repeat"] = "";
|
||||
})
|
||||
}
|
||||
|
||||
if (Array.isArray(this.config.cheats)) {
|
||||
for (let i=0; i<this.config.cheats.length; i++) {
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
config.gameParentUrl = window.EJS_gameParentUrl;
|
||||
config.netplayUrl = window.EJS_netplayServer;
|
||||
config.gameId = window.EJS_gameID;
|
||||
config.backgroundImg = window.EJS_backgroundImage;
|
||||
|
||||
if (typeof window.EJS_language === "string" && window.EJS_language !== "en-US") {
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue