BinBashBanana / webretro

RetroArch in your browser
https://binbashbanana.github.io/webretro/
MIT License
249 stars 350 forks source link

mobile support? #19

Closed RuralAnemone closed 1 year ago

RuralAnemone commented 2 years ago

would it be possible to detect if you're on mobile and then have some controls overlayed?

BinBashBanana commented 2 years ago

That should be pretty easy to do, but I'll also need to add emscripten touch/pointer support in the rwebinput driver in order to make it work. Mobile support is something that I've wanted to do for a while, so I'll see what I can do.

ethanaobrien commented 2 years ago

Actually, I’d recommend doing what the original emulatorjs did, they have a simulate input function that sends the button presses to the emulator, so all of the listeners are actually in JavaScript. The control mapping is all JavaScript too, and all virtual game pad does in the original emulatorjs version is that it calls this simulate input function with specific button presses, this’d be pretty difficult to do though, I’ve tried to rewrite the input driver to support it so control mapping and virtual game pad would work on my new versions but I’ve never been able to figure out how it worked

BinBashBanana commented 2 years ago

Good news - touchscreen support will be in the next update! I'm using the neo-retropad overlay which has an option to toggle between d-pad and analog.

BinBashBanana commented 2 years ago

Here's a preview:

Show --- ![Screenshot 2022-08-23 230335](https://user-images.githubusercontent.com/51469593/186312188-87641128-6387-45da-8996-455c3cb090b0.png) --- ![Screenshot 2022-08-23 230538](https://user-images.githubusercontent.com/51469593/186312189-f536bf49-2671-444b-8f7f-7cade6fd691f.png) ---

The controls will also move to the side of the screen if the screen is horizontal, just like mobile RetroArch.

RuralAnemone commented 2 years ago

oh wow you did a lot more than I thought lol :)

looks great!

szllzs commented 2 years ago

very expect