Keycodes on Linux/Mac/Windows

BlitzMax Forums/BlitzMax Programming/Keycodes on Linux/Mac/Windows

Derron(Posted 2014) [#1]
Hi,

does one actually has a "keycode wrapper" so it works flawless on Linux/Mac/Windows?


Eg. on a German installation of Mac OS X I get "Key_Z" and "Key_Y" switched (German keyboards have Z and Y switched).

Using the same keyboard on Windows/Mac (and of course the "German keyboard layout" is set), that keys are correctly recognized.


The characters above the normal "Numbers input" (above the letters-area of the keyboard) are also not recognized correctly. Depending on the keyboard layout, things are not recognized as they should.

All in all: It seems that BlitzMax ignores "layouts" there too.

If you use "GetChar" the Z/Y are correctly recognized, also the "secondary" values of the number-keys.

Other characters on a keyboard are not represented ("non-ascii") as well:

?Win32
        Keycode 186 = "ü"
        Keycode 192 = "ö"
        Keycode 222 = "ä"
?Linux
        Keycode 252 = "ü"
        Keycode 246 = "ö"
        Keycode 163 = "ä"
?
...


That there is no "default" way of handling everything in vanilla blitzmax is clear to me - so has someone else "fiddled around" with that issue already?


For "clicketyclick" games you wont see a need for this, but as soon as you allow more than Aa-Zz0-9 for your player names (or ask for other input) you may run into trouble.


EDIT: While "GetChar" recognizes many "special keys" (like the "@" done with the "apple + L" or "AltGr + Q" it still has some flaws with "umlauts".
So: if KeyHit would use the "position on the keyboard", the values of "z or y" would not differ when switching from German to English layout - but they do, so there is something done not as it should.


EDIT2: Meanwhile I simplified my current "gui input"-recognition to use "getChar" where possible (many special keys are now recognized correctly on mac,win,linux).
Only exceptions I found till now:
- Umlauts on all platforms.
- euro sign on linux platforms.

I did not test other special chars like ¢„““”µ·…– æſðđŋħ¶ł and whatever altgr + A-Z keys enable on linux systems :D

bye
Ron