Scancode->Ascii->Scancode converter

Community Forums/Showcase/Scancode->Ascii->Scancode converter

Perturbatio(Posted 2004) [#1]
Would anyone have any use for a userlib that converts Scancode->Ascii->Scancode?

I can't test if there is actually a use for it, since I'm using a UK keyboard layout and so will get normal results anyway.

Could someone with a non UK/US keyboard please test it and see if it returns the correct characters for the keys?

Does this post make sense? Does there seem any point to this DLL?

download here


slave_of_time(Posted 2004) [#2]
looks like it's working correct.


Perturbatio(Posted 2004) [#3]
do you have a non UK/US keyboard?


soja(Posted 2004) [#4]
Is there a difference between this and using MapVirtualKeyEx (user32)?


slave_of_time(Posted 2004) [#5]
yes, i have a non UK/US Keyboard


Perturbatio(Posted 2004) [#6]
Does MapVirtualKeyEx translate to/from Ascii?


Beaker(Posted 2004) [#7]
Sounds very useful to me.


jhocking(Posted 2004) [#8]
What is this useful for? I'm just ignorant about everything today.


Perturbatio(Posted 2004) [#9]
I'm hoping it will help get around the non UK/US keyboard input issues, but I don't know for sure yet since I don't have one.


Perturbatio(Posted 2004) [#10]
Ok, here's another possible use for it (redefining of keys):
Graphics 640,480,0,2


Type controls
	Field kUp
	Field kDown
	Field kLeft
	Field kRight
End Type

Type player
	Field x
	Field y
	Field image
	Field controls.controls
End Type




Global player1.player = New player
	player1\x=320
	player1\y=240
	player1\image = CreateImage(32,32)
	Player1\controls.controls = New controls
	SetBuffer ImageBuffer(player1\image)
	Color 255,0,0
	Rect 0,0,32,32,1

Color 255,255,255
SetBuffer FrontBuffer()

Text 0,0, "press key for up: "
player1\controls\kUp = AsciiToScancode(WaitKey())
Text 22*FontWidth(),0,Chr(ScancodeToAscii(player1\controls\kUp))

Text 0,12, "press key for down: "
player1\controls\kDown = AsciiToScancode(WaitKey())
Text 22*FontWidth(),12,Chr(ScancodeToAscii(player1\controls\kDown))

Text 0,24, "press key for left: "
player1\controls\kLeft = AsciiToScancode(WaitKey())
Text 22*FontWidth(),24,Chr(ScancodeToAscii(player1\controls\kLeft))

Text 0,36, "press key for right: "
player1\controls\kRight = AsciiToScancode(WaitKey())
Text 22*FontWidth(),36,Chr(ScancodeToAscii(player1\controls\kRight))



Text GraphicsWidth()/2,100,"press any key to continue",True
WaitKey()

Cls

SetBuffer BackBuffer()

While Not KeyDown(1)

If KeyDown(player1\controls\kUp) Then 
	player1\Y = player1\y-2
	If player1\y<0 Then player1\y = 0
EndIf

If KeyDown(player1\controls\kDown) Then 
	player1\Y = player1\y+2
	If player1\y > GraphicsHeight()-32 Then player1\y = GraphicsHeight()-32
EndIf

If KeyDown(player1\controls\kLeft) Then 
	player1\x = player1\x-2
	If player1\x<0 Then player1\x = 0
EndIf

If KeyDown(player1\controls\kRight) Then 
	player1\x = player1\x+2
	If player1\x > GraphicsWidth()-32 Then player1\x = GraphicsWidth()-32
EndIf

DrawImage player1\image, player1\x, player1\y


Flip
Cls

Wend

End


*EDIT*

It does however, only work with keys that return valid ascii values.


eBusiness(Posted 2004) [#11]
It works with æ, ø and å.