Page 1 of 1

Pause key not registering every press

Posted: Fri Jul 21, 2023 5:50 am
by coco2
I'm having an issue with the pause key, it doesn't seem to register every press. Am I doing it wrong?

Code: Select all

Dim Keyb.i(255)
Debug "Starting..."
If InitSprite() And InitKeyboard()
  OpenWindow(0, 30, 30, 640, 480, "Test")
  OpenWindowedScreen(WindowID(0), 0, 0, 640, 480, #True, 0, 0, #PB_Screen_NoSynchronization)
  Repeat
    Delay(10)
    Event = WindowEvent()
    Select Event
      Case #PB_Event_CloseWindow
        Debug "ProcessWindowEvents: quit"
        Quit = 1
        Pause = 0
    EndSelect    
    ExamineKeyboard()
    For c = 0 To 255
      If KeyboardPushed(c)
        If Not Keyb(c)
          Keyb(c) = 1
          Debug "Key " + Str(c) + " pushed"
        EndIf
      EndIf        
      If KeyboardReleased(c)
        ; Release the key
        Keyb(c) = 0
      EndIf
    Next
  Until KeyboardPushed(#PB_Key_Escape) Or Quit
EndIf

Re: Pause key not registering every press

Posted: Fri Jul 21, 2023 6:29 am
by BarryG
Works every time here. Keyboard/hardware issue, maybe? Compare with a USB keyboard if you can.

Re: Pause key not registering every press

Posted: Fri Jul 21, 2023 6:32 am
by coco2
Interesting I could possibly be looking at a faulty keyboard. I'll test with another one.

Edit: another keyboard works perfectly so I conclude I have a faulty keyboard

Re: Pause key not registering every press

Posted: Fri Jul 21, 2023 8:12 am
by BarryG
Maybe not faulty as such, but probably a lower polling rate for the keyboard in question.