ebiten icon indicating copy to clipboard operation
ebiten copied to clipboard

ui: native text input components to input texts with IMEs

Open hajimehoshi opened this issue 5 years ago • 6 comments

I'm not sure this should be in Ebiten core, but this should be useful.

hajimehoshi avatar Dec 20 '19 18:12 hajimehoshi

Related to #286

hajimehoshi avatar Dec 20 '19 18:12 hajimehoshi

Note: If we want to support only keyboards, we can have transparent text fields.

hajimehoshi avatar Oct 27 '20 06:10 hajimehoshi

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.

tslocum avatar Mar 08 '22 23:03 tslocum

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,

hajimehoshi avatar Mar 09 '22 05:03 hajimehoshi

I don't think I can make it for v2.4 unfortunately.

hajimehoshi avatar Jul 09 '22 05:07 hajimehoshi

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/

hajimehoshi avatar Aug 01 '22 04:08 hajimehoshi

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.

bjorndm avatar Jul 15 '23 01:07 bjorndm

Yeah I know it and I decided to implement the API by myself

hajimehoshi avatar Jul 15 '23 02:07 hajimehoshi

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.

bjorndm avatar Jul 15 '23 02:07 bjorndm

I'll close this. For other platforms, I'll create other separate issues.

hajimehoshi avatar Aug 28 '23 15:08 hajimehoshi