Getting ASCII Code of pressed key
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by merendo.
How do I find out the ASCII Code of a key, which the user has pressed? Please don´t tell me, that I have to use Inkey() 'cos this command needs a console opened first and I don´t want to open one.
Can you help me? Does your solution also tell me, if there is a key pressed (How to find out the ASCII Code of a pressed key, if there is no key pressed)
Thanks for any help, merendo
We always need to hear both sides of the story (by Phil Collins)
How do I find out the ASCII Code of a key, which the user has pressed? Please don´t tell me, that I have to use Inkey() 'cos this command needs a console opened first and I don´t want to open one.
Can you help me? Does your solution also tell me, if there is a key pressed (How to find out the ASCII Code of a pressed key, if there is no key pressed)
Thanks for any help, merendo
We always need to hear both sides of the story (by Phil Collins)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> How do I find out the ASCII Code of a key, which the user has pressed?
Not sure yet, but I may come up with an answer later when I have time.
>Can you [...] tell me, if there is a key pressed
You can use the following to check the state of any key:
PB - Registered PureBasic Coder
> How do I find out the ASCII Code of a key, which the user has pressed?
Not sure yet, but I may come up with an answer later when I have time.
>Can you [...] tell me, if there is a key pressed
You can use the following to check the state of any key:
Code: Select all
InitKeyboard() ; Must be called before checking keys.
Repeat
sleep_(1) ; To stop using 100% of CPU.
ExamineKeyboard() ; Check status of all keys.
If KeyboardPushed(#PB_Key_All)0 : Debug "Keys are being pressed" : EndIf
If KeyboardPushed(#PB_Key_Space)0 : Debug "The Spacebar is being pressed" : EndIf
Until KeyboardPushed(#PB_Key_Escape)0 ; Quit if Esc is pressed.
PB - Registered PureBasic Coder
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tranquil.
))))
Mike
Tranquilizer/ Secretly!
Registred PureBasic User
In fact, catching events withour a window is very hard.> Please wait for events, everytime!
It was just for that example because the example had no window...
PB - Registered PureBasic Coder
Mike
Tranquilizer/ Secretly!
Registred PureBasic User
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by merendo.
Yes. It is VERY hard to catch events without a window
))) .
No, seriously: I don't want to open a window, I need the ascii code finder for a game which me and a few friends of mine are coding. I want to create a text input for the game and need to find out the ascii code of the key which the user has pressed.
Cu @ll, merendo
We always need to hear both sides of the story (by Phil Collins)
Yes. It is VERY hard to catch events without a window
No, seriously: I don't want to open a window, I need the ascii code finder for a game which me and a few friends of mine are coding. I want to create a text input for the game and need to find out the ascii code of the key which the user has pressed.
Cu @ll, merendo
We always need to hear both sides of the story (by Phil Collins)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by merendo.
In Case??? I don't know what you mean. I just want to find out the ascii codes, nothing more and nothing less. ASCII Code, I think you know what this is: 78 is M . I want to use the Asc command to create an input field in my game.
We always need to hear both sides of the story (by Phil Collins)
In Case??? I don't know what you mean. I just want to find out the ascii codes, nothing more and nothing less. ASCII Code, I think you know what this is: 78 is M . I want to use the Asc command to create an input field in my game.
We always need to hear both sides of the story (by Phil Collins)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> I just want to find out the ascii codes, nothing more and nothing less.
Try my new GetKey() procedure here: http://tinyurl.com/il2
PB - Registered PureBasic Coder
Edited by - PB on 29 June 2002 12:18:59
> I just want to find out the ascii codes, nothing more and nothing less.
Try my new GetKey() procedure here: http://tinyurl.com/il2
PB - Registered PureBasic Coder
Edited by - PB on 29 June 2002 12:18:59
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm