Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Raspberry Pi / GetRawKeyState not working?

Author
Message
MikeZhangTNS
6
Years of Service
User Offline
Joined: 23rd May 2017
Location:
Posted: 25th May 2017 19:15 Edited at: 25th May 2017 20:36
I wrote a Pong program in Basic on Windows and then opened the file onto my raspberry pi. Everything seemed to load fine, but the keyboard presses are not working anymore. I used GetRawKeyState to map "w" and "s" to one paddles up and down and the up and down arrow keys to the other. The get pointer state command words so I am at a loss. I tried two different keyboards as well.

EDIT: I also did some more testing and StartTextInput() works, but GetRawKeyPressed() or GetRawKetState() does not.
MikeZhangTNS
6
Years of Service
User Offline
Joined: 23rd May 2017
Location:
Posted: 25th May 2017 20:40
I wrote a pong program on the Windows version of AppGameKit and copied the files to a Raspberry Pi. The program loads, but the keyboard inputs do not work. I used GetRawKeyState() to map w,s, up and down arrows to move the paddles of the pong game.

EDIT: I have tested GetKeyboardExists(), and StartTextInput(), both which confirm that the keyboard exists and works. GetPointerState() also works for the mouse. It appears as if only GetRawKeyState() and GetRawKeyPressed() are not working. Any advice would be nice

(P.S. I accidentally deleted the contents of the post when adding the Edit so I apologize if it's changed a little).
MikeZhangTNS
6
Years of Service
User Offline
Joined: 23rd May 2017
Location:
Posted: 25th May 2017 23:34
Hi Everyone,

I figured out what went wrong. For some reason, my Pi cannot select the keyboard layout English (US) under United States. It would default to the Spanish Keyboard. Once I changed the keyboard the UK or Canada English, all worked again.

Thanks!

Login to post a reply

Server time is: 2024-03-29 11:16:37
Your offset time is: 2024-03-29 11:16:37