Default controls

This commit is contained in:
Ethan O'Brien 2023-07-03 09:38:29 -05:00
parent dcd01210a1
commit 52152720d6
2 changed files with 3 additions and 0 deletions

View file

@ -156,6 +156,7 @@ class EmulatorJS {
this.cheats = []; this.cheats = [];
this.started = false; this.started = false;
this.volume = (typeof this.config.volume === "number") ? this.config.volume : 0.5; this.volume = (typeof this.config.volume === "number") ? this.config.volume : 0.5;
if (this.config.defaultControllers) this.defaultControllers = this.config.defaultControllers;
this.muted = false; this.muted = false;
this.paused = true; this.paused = true;
this.listeners = []; this.listeners = [];
@ -1288,6 +1289,7 @@ class EmulatorJS {
const controls = this.createElement("div"); const controls = this.createElement("div");
for (let i=0; i<4; i++) { for (let i=0; i<4; i++) {
if (!this.controls[i]) this.controls[i] = {};
const player = this.createElement("div"); const player = this.createElement("div");
const playerTitle = this.createElement("div"); const playerTitle = this.createElement("div");

View file

@ -54,6 +54,7 @@
config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings; config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings;
config.buttonOpts = window.EJS_Buttons; config.buttonOpts = window.EJS_Buttons;
config.volume = window.EJS_volume; config.volume = window.EJS_volume;
config.defaultControllers = window.EJS_defaultControls
new EmulatorJS(EJS_player, config); new EmulatorJS(EJS_player, config);