nenge123 / emulatorjs

https://emulatorjs.com/
14 stars 12 forks source link

Mobile vIrtual buttons appearance issue #14

Open shaylevary opened 3 months ago

shaylevary commented 3 months ago

Hi,

When I try to enter the emulator script from my mobile, all the virtual buttons appeared messed. Screenshot_20240708_183940_Chrome

Only after i click on customize/move virtual buttons icon (on the top right of the screen), it fix the issue, until I refresh the page again.

Screenshot_20240708_182233_Chrome

I will appreciate any help on fixing this issue, in order to make the virtual buttons appear correctly when starting the emulator.

nenge123 commented 3 months ago

mobile using touch event,more hand have more touchEvent。

in the emulatorjs every button sigle event (pointdown pointout)

when hand out of button will stop and move in button will running

you see gba.nenge.net is's using emulatorjs core and retroarch build bot core.

< div id="gamepad"> more button < /div>

gamepad.ontouchmove = func; gamepad.ontouchstart = func;

func(event) btn =[]; if(event.type=="touchstart") btn = [event.target]; else Array.from(event.touches,hand=>{ btn.push(document.elementFromPoint(hand.pageX,hand.pageY)); });

//The object that all fingers click btn //Cache the last click, if it is different, "press up" the different settings, otherwise it will be pressed.

shaylevary commented 3 months ago

Hi,

First of all, thanks for the explanations.

The main problem is that after I changed the position of the buttons and then I press "Reset All" button in order to reset all buttons back to their original position, it does not save the buttons in their original position (after the rest), so if i refresh the page, the buttons return to the places I've moved them before the reset. The only possibility that it will save the buttons locations after the reset is if I move one of the buttons a little and then press save button.

Is it possible to fix the emulatorjs.js code, so when I perform "Reset All" it will automatically keep the position of the buttons in their original place?

Thank you.

nenge123 commented 3 months ago

To save the key layout, it should be enough to delete the corresponding localstore. There may be an error in the reset function, and the configuration has not been deleted

shaylevary commented 3 months ago

Will you be able to fix the reset function, so it will save the key layout changes when click the reset button? Or do you have any js command that I can add in order to reset key layout every time I refresh and enter the script?

nenge123 commented 2 months ago

sorry, I am longtime no see this js,when i using steamdeck。apple ios accept emulator app.

It is recommended that you rewrite the button layout of the web simulator and run all cores independently. Its operating mechanism is actually very simple! Really, it's not complicated at all! In addition, multiplayer games are not difficult to achieve, just a post request and then open a persistent link.