Problem with KeyboardPushed(#PB_Key_Pause)

Just starting out? Need help? Post your questions and find answers here.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Problem with KeyboardPushed(#PB_Key_Pause)

Post by Psychophanta »

In a full screen environment, the pause key seems to fail here.
In the main loop i do:

Code: Select all

ExamineKeyboard()
...
ElseIf KeyboardPushed(#PB_Key_Pause)
    Repeat:FlipBuffers():Delay(21):ExamineKeyboard():Until KeyboardPushed(#PB_Key_Pause)=0
...
FlipBuffers()
  
and it does not work, but with any other key it does work :? :o
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: Problem with KeyboardPushed(#PB_Key_Pause)

Post by BarryG »

User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: Problem with KeyboardPushed(#PB_Key_Pause)

Post by Psychophanta »

Thanks, looks like another inherited IBM-PC-XT hardware bug. :|
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
benubi
Enthusiast
Enthusiast
Posts: 227
Joined: Tue Mar 29, 2005 4:01 pm

Re: Problem with KeyboardPushed(#PB_Key_Pause)

Post by benubi »

Two things you may overlook

1) You may flush directly through the loop. Use KeyboardReleased() on the first check behind ElseIf. The way you check the user has to quickly release the button and what happens when he started pressing it 1ms before frame flip but average holding time is 25ms? Right, you flush through the loop and the Pause key is believed pressed/released again when in fact it was the same push event.

2) You may also need to process window events since they can carry mouse and keyboard inputs into your app

What could be of use would be a 3rd keyboard query function in the library to check for keyboard hits, checking if the key has been pressed for the "first" time. I tried to implement such things myself but on Linux I met difficulties because some #PB_Key_ constants have negative values, or are above 256, which makes it complicated to implement without a Map or so.
Post Reply