MCPcopy Index your code
hub / github.com/EmulatorJS/EmulatorJS / createStartButton

Method createStartButton

data/src/emulator.js:433–458  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

431 }
432 // Start button
433 createStartButton() {
434 const button = this.createElement("div");
435 button.classList.add("ejs_start_button");
436 let border = 0;
437 if (typeof this.config.backgroundImg === "string") {
438 button.classList.add("ejs_start_button_border");
439 border = 1;
440 }
441 button.innerText = (typeof this.config.startBtnName === "string") ? this.config.startBtnName : this.localization("Start Game");
442 if (this.config.alignStartButton == "top") {
443 button.style.bottom = "calc(100% - 20px)";
444 } else if (this.config.alignStartButton == "center") {
445 button.style.bottom = "calc(50% + 22.5px + " + border + "px)";
446 }
447 this.elements.parent.appendChild(button);
448 this.addEventListener(button, "touchstart", () => {
449 this.touch = true;
450 })
451 this.addEventListener(button, "click", this.startButtonClicked.bind(this));
452 if (this.config.startOnLoad === true) {
453 this.startButtonClicked(button);
454 }
455 setTimeout(() => {
456 this.callEvent("ready");
457 }, 20);
458 }
459 startButtonClicked(e) {
460 this.callEvent("start-clicked");
461 if (e.pointerType === "touch") {

Callers 1

constructorMethod · 0.95

Calls 5

createElementMethod · 0.95
localizationMethod · 0.95
addEventListenerMethod · 0.95
startButtonClickedMethod · 0.95
callEventMethod · 0.95

Tested by

no test coverage detected