-
Notifications
You must be signed in to change notification settings - Fork 64
Virtual/screen keyboard support #80
Comments
(clarified a mistake about fullscreen) |
Several "javascript virtual keyboards" exist, notably https://github.com/hodgef/simple-keyboard which has no dependencies (though none of them describe why they were developed in the first place). I'm not sure what stack should provide the virtual keyboard. I'm wondering what's the SDL team's stance on shipping additional javascript+css code in SDL2 to handle an IME? |
Alternatively, I made a test with an off-screen HTML text input, to leverage the browser's built-in support. This properly show/hides the virtual keyboard on focus/unfocus, and JS events allowed tracking what was typed. Keycodes are caught and forwarded to the application as well, for consistency with SDL2/Android. https://www.beuc.net/tmp/ti1.html Limitations:
With these limitations it sounds like this isn't the right approach, but I'd be happy to discuss this further. |
Also here's a sample SDL2 app for comparing the behavior between desktop/web/android: |
Referencing emscripten-discuss thread for info: Also given there was 0 reaction here after 1 year, it is unlikely that any solution will be implemented at the SDL2 layer :/ |
@Beuc I'd find a solution for that problem useful aswell |
@feliwir In the end we had to re-implement a keyboard in-game: |
I too could use this functionality. The off-screen text field thing is the type of workaround that would be consistent with Emscripten's approach. Myself, I'll try superimposing a visible text field first. A special soft keyboard like you're apparently doing for Ren'Py would be a bit heavy and non-native, but for a VN it's probably not a problem. |
HTML form superimposed over the canvas activates the soft keyboard but does not accept input (input being received by SDL with
EDIT: The |
they create an invisible contenteditable div that they update to always
contain the text of the line you are working on, and that has the focus
and is where text input is sent.
Could work. I use a text field with 0 opacity, but don't tell Google
because of "security" or whatever.
|
Hi,
AFAICS there is no on-screen keyboard support in the Emscripten SDL2 port, which is a problem on mobile platforms.
There doesn't seem to be a browser API to control the virtual keyboard (or maybe I missed it?), so we could:
<input type="text">
element somehowThe text was updated successfully, but these errors were encountered: