Emscripten: Rework touch input and add pixel-perfect scaling#3556
Emscripten: Rework touch input and add pixel-perfect scaling#3556johannschopplich wants to merge 7 commits into
Conversation
|
Jenkins: Test this please Thanks! Have to take a look at this :) |
The shell sized the canvas from document.body, which collapses to zero height in this layout, so SDL's inline size shrank it on load (most visibly in Chrome). Make the fit-mode CSS authoritative with !important, and recompute integer scaling from a ResizeObserver on the viewport so it reflows correctly after an orientation change instead of overflowing.
Clicking a control button moves focus to the button and swallows the arrow keys. Return focus to the canvas after a control click and on fullscreen change so keyboard input keeps reaching the game.
|
Pushed a follow-up batch from the same setup: a save manager! Fits nicely into the design. Updated the description above accordingly. 🙂 |
|
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. |
|
@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.) |
|
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 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 👍 |
This PR brings a batch of web-shell improvements over from my production setup on realtroll.de. Mostly touch and scaling work that's been running there a while – figured it's worth upstreaming rather than sitting in a fork. 🙂
What's New?
localStorage. Defaults on for non-touch devices – a visible change for existing desktop pages, so happy to flip it to opt-in if you'd rather not move the default..lsdsave file into the first free slot, and grab a screenshot. Built on a native<dialog>, touch-friendly.Smaller bits
visibilitychangeso the screen doesn't sleep mid-session.scanGamePadspoll – it only armed whenongamepadconnectedwas missing, but those events predate WASM in every browser, so nothing that can run the player reached that path.<symbol>/<use>).The embedded player should work as is, integer scaling is of course disabled in this case.
Tested on past + edge releases of the EasyRPG Player build I ship at realtroll.de, desktop + touch (Android/iOS).