Get keyboard press key
Posted: Fri Apr 23, 2004 11:44 am
Hi
How can i get one key when user press that in keyboard ?
How can i get one key when user press that in keyboard ?
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
initkeyboard()
;inits and co.
;start-mainloop
examinekeyboard()
if keyboardpushed(#PB_Key_Space)
;do this, after key-space was pushed
endif
;end-mainloop
Remember when you use the above InitKeyboard(), ExamineKeyboard(), etc.. DirectX v7+ must be installed! You can use the Win32 API to avoid the need of having DX installed. See: viewtopic.php?t=9437 I think there was a native command added in v3.90 to do this, check the history.txt file and Reference.Sunny wrote:To check one special key, use this commands:Code: Select all
initkeyboard() ;inits and co. ;start-mainloop examinekeyboard() if keyboardpushed(#PB_Key_Space) ;do this, after key-space was pushed endif ;end-mainloop
Code: Select all
a.l = 0
Repeat
ExamineKeyboard()
If KeyboardPushed(#PB_KEY_SPACE)
a +1
EndIf
Until KeyboardPushed(#PB_KEY_ESCAPE)