TheKrokodil's picture

[Input] Converting OpenTK.Input.Key keys to chars

Hi there!

Although the current Keyboard implementation works fine for standard OpenGL applications and games, I would appreciate a way to convert those Keys to actual real chars (for ingame console/textfield purposes). As I'm using the OpenTK GameWindow I can't accept WM_ messages directly; , and as I don't want to loose the multi-platform support, I cannot reverse the process of mapping OpenTk Keys -> Virtual Keys -> chars by using Win32 functions.

I don't know whether its possible, but it would be really nice if you not just save the OpenTK key, but also the char representation.

While simple input methods like A-Z and 0-9 can be converted easily, brackets and such are harder to convert because of different keyboard layouts.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Yes, this would be very useful. A feature request exists (#759: [GameWindow] Add character information to input events) and I hope to implement this in the near future. However, this is much more complicated to implement than I initially suspected, so it may take some time to implement correctly.

Of course, any and all help appreciated.

Edit: Added an initial implementation on win32. It seems to have one or two kinks (escape key generates a keychar?) but otherwise works fine.

An implementation on X is much more complicated - I'll handle that next. Unfortunately, I have no idea how to implement this on Carbon.