Skip to content

Emscripten: Rework touch input and shell layout - #3556

Open
johannschopplich wants to merge 3 commits into
EasyRPG:masterfrom
johannschopplich:emscripten-shell-rework
Open

Emscripten: Rework touch input and shell layout#3556
johannschopplich wants to merge 3 commits into
EasyRPG:masterfrom
johannschopplich:emscripten-shell-rework

Conversation

@johannschopplich

@johannschopplich johannschopplich commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

This PR brings the web-shell improvements from my production setup on realtroll.de – touch and layout work that's been running there a while.

Per review, reduced to the shell rework itself: the integer scaling toggle is gone (covered natively by the settings scene), and the save manager moved to a follow-up PR based on this one.

What's in:

  • Touch controls – rewritten on Pointer Events: a responsive grid (d-pad / screen / action buttons) with safe-area insets, both orientations, replacing the floating corner buttons. Controls dim when idle and light back up on input.
  • Wake Lock – re-acquired on visibilitychange so the screen doesn't sleep mid-session.
  • Fullscreen button – toggles enter/exit and reflects its state; hidden where unsupported (iOS Safari).
  • Boot errors – show a message instead of a silently hanging loader (e.g. stale cached .wasm).
  • UI icons consolidated into one inline SVG sprite.
  • Dropped the legacy scanGamePads poll (ongamepadconnected predates WASM in every browser).

@github-actions github-actions Bot added the Emscripten WebAssembly/JavaScript port for web browsers label Jun 15, 2026
@Ghabry

Ghabry commented Jun 15, 2026

Copy link
Copy Markdown
Member

Jenkins: Test this please

Thanks! Have to take a look at this :)

@johannschopplich

Copy link
Copy Markdown
Contributor Author

Pushed a follow-up batch from the same setup: a save manager! Fits nicely into the design.

Updated the description above accordingly. 🙂

@jetrotal

Copy link
Copy Markdown
Contributor

Hello, since you are working on the touch screen buttons for the weblpayer, maybe consider taking a look at this proposal from a user called Bilou Master Joke: https://codepen.io/editor/BilouMaster/pen/019edf09-20e1-73a0-8efa-3ccb9a832518

He made a bunch of suggestions to both support the complete vanilla keyboard, and some quality of life usage of buttons.

@johannschopplich

Copy link
Copy Markdown
Contributor Author

@jetrotal Thanks for the input! Honestly, it feels a bit rough, but it's a draft anyway. Worth digging into for a future iteration after this PR. (It already touches a lot of parts of the shell.)

@BilouMaster

Copy link
Copy Markdown

Ah yes, that's perfect because I've been doing the design only like an empty shell and not finished/merged with the real player yet, so I'll also take inspiration of your work then! :D

You can check the codepen Jetrotal shared (most recent take) or my old previous player which had better layout too but not commutable/customisable yet
https://biloumaster.fr/jeux/bogossstory

I like your buttons for importing save files or toggle between perfect pixel/not perfect, that's a good point but they are small and too close to each other, it would likely need a bit scale up + more margin but 👍

@johannschopplich

Copy link
Copy Markdown
Contributor Author

@BilouMaster Love the input. 🙏 Yeah sure! Maybe we can collaborate on the implementation. My take: Giving users too much customization options clutters interfaces. I prefer a unified polished interface in general. But that's personal preference, eh.

On the buttons – good catch. The icon controls had too little spacing between them (due to my buttons control unification in this PR). I've improved every tap target and given the control row more room.

@BilouMaster

Copy link
Copy Markdown

The customisation costs nothing and I'm planning to set the perfect ratio by default so the customisation will just be a fallback for accessibility and non anticipated cases like non conventional devices, I feel it's safer to add some free settings beside the way we think it's good.

The swap Enter/Echap have been demanded many times for example

Sure we can collaborate on this, I will clone your branch (or the merged in official if the pr is accepted) when I'll have time to re-work on this, I've had many other things to do lastly :)

Let's build the perfect controller together, this big beauty of a project needs it :D

@Ghabry

Ghabry commented Jul 29, 2026

Copy link
Copy Markdown
Member

First thanks for the contribution. Some remarks:

Emscripten: Add pixel-perfect integer scaling toggle: this is already supported native in the settings scene. Maybe make the button open the settings scene instead?

Emscripten: Fix canvas scaling on load and orientation change: Have to check if SDL3 still needs this

Emscripten: Add save manager, fullscreen toggle, and SVG icon sprite: honestly for this one and the follow up commits I would prefer a 2nd PR (based on this one). This is quite complex and I don't really like that hooking of the private API instead of impending this properly in pre/post.js. The scaling factor of the screenshot is also available as a setting in the settings scene btw.

@johannschopplich
johannschopplich force-pushed the emscripten-shell-rework branch from 1c5c5f8 to b96301b Compare July 30, 2026 08:48
@johannschopplich johannschopplich changed the title Emscripten: Rework touch input and add pixel-perfect scaling Emscripten: Rework touch input and shell layout Jul 30, 2026
@johannschopplich

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I agree, the PR mixed concerns. Refactored:

  • Integer scaling toggle: gone. You're right, the settings scene covers this.
  • Canvas scaling on load/orientation change: the !important sizing workaround is already on master; this PR merely re-expresses it for the new layout. Happy to drop it everywhere if SDL3 no longer needs it.
  • Save manager: split into a follow-up PR.

@johannschopplich
johannschopplich force-pushed the emscripten-shell-rework branch from b96301b to 3b7b8fc Compare July 30, 2026 09:02
@Ghabry

Ghabry commented Jul 30, 2026

Copy link
Copy Markdown
Member

Jenkins: test this please

Thanks this looks more reasonable for the PR now. Will test it a bit tomorrow - also regarding SDL3 behaviour - and then this should be good to go.

@johannschopplich

Copy link
Copy Markdown
Contributor Author

Thanks a lot! Looking forward to your tests. 🙂

Follow-up created (based on this one): #3643

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Emscripten WebAssembly/JavaScript port for web browsers

Development

Successfully merging this pull request may close these issues.

4 participants