Scancodes (independant from keyboard type)

BlitzMax Forums/BlitzMax Beginners Area/Scancodes (independant from keyboard type)

Marmoth(Posted 2006) [#1]
Hi!

I have been using b+ for a while and got used to it's scancode system.

There is a feature that i couldn't find on bmax, and i would like to know if it exists at all:

The old b+ scancodes were linked to the position of the key on the keyboard and not on the relative character. This was very handy for me because i am not using english keyboard.

How can i check if a key is down (or has been hit) according to its position on the keyboard and not to the character it represents? (is it possible at all? if not, is there alternative solution as switching to a particular keyboard type at the start of the program?)


ImaginaryHuman(Posted 2006) [#2]
Doesn't seem possible, and since Max is cross-platform compatible that's probably why you now have to detect based on the key itself. Maybe Max should know which key is actually which, and you don't need to worry about finding the right button.


ImaginaryHuman(Posted 2006) [#3]
Use KeyDown() or KeyHit()
And see the Scancodes section of the modules section of the help.


Marmoth(Posted 2006) [#4]
I actually tried keydown() to test it:

as i have got a QWERTZ keyboard, i tried with

keydown(KEY_Y)

it didnt react as i pressed my "Z" key (i.e. the sixth key of the to row) but did as i pressed my "Y" key (i.e. the first of the third row).

(same using the number keydown(89))


tonyg(Posted 2006) [#5]
Can you use Getchar?


TomToad(Posted 2006) [#6]
Best I could tell you is to write a remap function. Something like this.




ImaginaryHuman(Posted 2006) [#7]
That works.