mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2024-09-20 02:46:23 +00:00
add new option EJS_alignStartButton
This commit is contained in:
parent
3138bf7939
commit
91d44e54dd
5 changed files with 14 additions and 4 deletions
|
@ -173,7 +173,6 @@
|
|||
|
||||
.ejs_start_button:active, .ejs_start_button:hover {
|
||||
animation: ejs_start_button_pulse 2s infinite;
|
||||
bottom: 65px;
|
||||
}
|
||||
|
||||
@keyframes ejs_start_button_pulse {
|
||||
|
|
|
@ -250,6 +250,7 @@ class EmulatorJS {
|
|||
this.listeners = [];
|
||||
this.setElements(element);
|
||||
this.setColor(this.config.color || "");
|
||||
this.config.alignStartButton = (typeof this.config.alignStartButton === "string") ? this.config.alignStartButton : "bottom";
|
||||
this.config.backgroundColor = (typeof this.config.backgroundColor === "string") ? this.config.backgroundColor : "rgb(51, 51, 51)";
|
||||
if (this.config.adUrl) {
|
||||
this.config.adSize = (Array.isArray(this.config.adSize)) ? this.config.adSize : ["300px", "250px"];
|
||||
|
@ -405,8 +406,17 @@ class EmulatorJS {
|
|||
createStartButton() {
|
||||
const button = this.createElement("div");
|
||||
button.classList.add("ejs_start_button");
|
||||
if (typeof this.config.backgroundImg === "string") button.classList.add("ejs_start_button_border");
|
||||
let border = 0;
|
||||
if (typeof this.config.backgroundImg === "string"){
|
||||
button.classList.add("ejs_start_button_border");
|
||||
border = 1;
|
||||
}
|
||||
button.innerText = this.localization("Start Game");
|
||||
if (this.config.alignStartButton == "top"){
|
||||
button.style.bottom = "calc(100% - 20px)";
|
||||
}else if (this.config.alignStartButton == "center"){
|
||||
button.style.bottom = "calc(50% + 22.5px + "+border+"px)";
|
||||
}
|
||||
this.elements.parent.appendChild(button);
|
||||
this.addEventListener(button, "touchstart", () => {
|
||||
this.touch = true;
|
||||
|
|
2
data/emulator.min.css
vendored
2
data/emulator.min.css
vendored
File diff suppressed because one or more lines are too long
2
data/emulator.min.js
vendored
2
data/emulator.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -58,6 +58,7 @@
|
|||
config.adMode = window.EJS_AdMode;
|
||||
config.adTimer = window.EJS_AdTimer;
|
||||
config.adSize = window.EJS_AdSize;
|
||||
config.alignStartButton = window.EJS_alignStartButton;
|
||||
config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings;
|
||||
config.buttonOpts = window.EJS_Buttons;
|
||||
config.volume = window.EJS_volume;
|
||||
|
|
Loading…
Reference in a new issue