keycodes wrong

BlitzMax Forums/BlitzMax Programming/keycodes wrong

Najdorf(Posted 2005) [#1]
is it just me or are many keycodes wrong?

for instance "y" should be 89 while its 121, "a" should be 65 while its 97 etc etc etc...
Graphics 300,300,0
Local a
Local olda

Repeat
Cls

a=GetChar()
If a<>0 olda=a
DrawText(olda),30,30


Flip
Until KeyDown(key_escape)



marksibly(Posted 2005) [#2]
GetChar() returns ascii codes, eg:

Print Asc("y")
Print Asc("a")

Print Asc("Y")
Print Asc("A")



Najdorf(Posted 2005) [#3]
You mean that "character code" is different from "key code?" hmm...


Yan(Posted 2005) [#4]
.


marksibly(Posted 2005) [#5]

You mean that "character code" is different from "key code?" hmm...



Yes.

Keycodes refer (more or less) to a keys physical location on a keyboard (or more precisely, the key with a particular 'glyph' on it), and doesn't take shift/ctrl etc into account.

Character codes on the other hand are affected by shift/ctrl etc and can be the result of multiple keystrokes.


rdodson41(Posted 2005) [#6]
for instance "y" should be 89 while its 121, "a" should be 65 while its 97 etc etc etc...

The ascii value for "A" is different from "a". "A" is 65 while "a" is 97. "A-Z" is 65-90, "a-z" is 97-122. The blitz keycodes just return the lowercase value.