ebiten
ebiten copied to clipboard
ui: native text input components to input texts with IMEs
I'm not sure this should be in Ebiten core, but this should be useful.
Related to #286
Note: If we want to support only keyboards, we can have transparent text fields.
Hello, I would like to take a shot at implementing this.
Since you asked to discuss the structure before submitting a PR, please see the initial work I've done:
Lots of stuff is still missing, of course. Ignoring that and focusing on the structure only, my initial draft adds an official InputField
widget to Ebiten. Once instantiated, the widget has Update
and Draw
methods which must be called during Game.Update
and Game.Draw
respectively. The widget also has a SetRect
method which updates its position and size.
Looking forward to hearing your thoughts.
Edit: To anyone seeking text input components, that do not require IME support, please see the messeji library.
Hi,
The intention of this issue is to use OS's API so that we can input texts with IMEs (e.g. Japanese texts). IMEs cannot be handled only with the current Ebiten API unfortunately.
Thanks,
I don't think I can make it for v2.4 unfortunately.
For GUI applications, not only IME inputting but also a lot of features like accesibility matter [1]. So, just introducing a rich text input might not solve what we really want to have. What about integrating a browser rendering engine and enabling to composite both Ebitengine and browser rendering? Even a native-look application can use a browser renderer (e.g. [2]).
[1] https://raphlinus.github.io/rust/gui/2022/07/15/next-dozen-guis.html [2] https://blog.jim-nielsen.com/2022/inspecting-web-views-in-macos/
There is a patch available for GLFW that enables IME on all platfoms:
https://github.com/glfw/glfw/pull/2130
If we apply this to the internal GLFW we can solve this issue . However, seeing that GLFW is not well supported it is probably better if we try to port as much of the code to Go as is possible.
Yeah I know it and I decided to implement the API by myself
OK, I didn't know you knew, so I just wanted to inform you. It is a good idea to implement it yourself, since GLFW is really not moving forward anymore.
I'll close this. For other platforms, I'll create other separate issues.