web: mobile: browser virtual keyboard support #2287
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently players on mobile web are stuck whenever the game asks text input (typically "what's your name").
As usual web support is tricky, and there's no API for the mobile browser virtual keyboard. My leads are:
(1) Map a HTML text input with SDL2 (character-based): cf. emscripten-ports/SDL2#80 -- APIs/events don't match, security policies are in the way, little external interest, probably not feasible
(2) Implement a virtual keyboard within Ren'Py: sounds OK; it won't support many characters or input methods but integration would be best
(3) Map a HTML text input with Ren'Py (line-based): sounds OK; supports the characters / input methods that the browser supports, integration is a bit rough (translucent text input at the top) but works
(4) Give up and tell devs/porters to do their own keyboard in Screen Language: hopefully not, I think we can provide a default something that works in the common case
This PR is a working attempt at (3).
I just see now that there's some issue with Firefox who simulates some keys events (space, /... but not letters) and messes things up, so this isn't ready yet, but I thought I'd be good to start the conversation.