From 8c767b735175a0c88d4bfcf96230ae06b3722c46 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Tue, 18 Jul 2023 09:59:31 -0500 Subject: [PATCH] Add background image option --- data/emulator.js | 12 ++++++++++++ data/loader.js | 1 + 2 files changed, 13 insertions(+) diff --git a/data/emulator.js b/data/emulator.js index e54f7c4..16a7aa7 100644 --- a/data/emulator.js +++ b/data/emulator.js @@ -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