Pause key not registering every press

Just starting out? Need help? Post your questions and find answers here.
coco2
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Pause key not registering every press

Post 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
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: Pause key not registering every press

Post by BarryG »

Works every time here. Keyboard/hardware issue, maybe? Compare with a USB keyboard if you can.
coco2
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Re: Pause key not registering every press

Post 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
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: Pause key not registering every press

Post by BarryG »

Maybe not faulty as such, but probably a lower polling rate for the keyboard in question.
Post Reply