How to trap ANY key pressed?
Blitz3D Forums/Blitz3D Programming/How to trap ANY key pressed?
| ||
| Hi is there a clever way to see if ANY key has been pressed without a wait? The GetKey does not trap keys that don't return an ascii value (i.e. shift, control etc) so that cannot be used. Any thoughts? |
| ||
Does this help...
Graphics 640,480
SetBuffer BackBuffer()
While Not KeyHit(1)
Cls
my_key=getmykey()
If my_key=0
Text 0,0,"No key hit"
Else
Text 0,0,my_key
EndIf
Flip
WaitKey()
; Take out waitkey for keydown for better test.
Wend
End
Function getmykey()
For x = 1 To 237
If KeyHit(x) Return x
; If keydown(x) return x
Next
End Function
|
| ||
| Odd, my keyboard doesn't have an 'ANY' key... :P |
| ||
| I'm feeling thirsty. I think I'll order a TAB. Oh! No time for that now, the computer's starting! |
| ||
| Doh! My thinking cap is at the dry cleaners. It was bloody obvious - thanks tonyg. |