KeyboardPushed()

Syntax

Result = KeyboardPushed(KeyID)
Description
Returns 0 if the specified key is not pressed, else it returns a non null value. Any number of key can be pressed at the same time. The command ExamineKeyboard() must be called before this command to update the keyboard state. The keyboard behaviour can be changed with KeyboardMode().

If you want to check, if a specified key has been pushed and released, take a look at the command KeyboardReleased().

Example:
  If InitSprite() And InitKeyboard() And OpenScreen(800,600,16,"")
    Repeat
      FlipBuffers()
      
      If StartDrawing(ScreenOutput())
        DrawText(0, 0, "Press ESC to quit")
        StopDrawing()
      EndIf
      
      ExamineKeyboard()
      If KeyboardPushed(#PB_Key_Escape)   ; press Esc to quit
        End
      EndIf
    ForEver
  EndIf


List of the valid KeyID values:
    #PB_Key_All   ; All keys are tested. Very useful for any key checks.

    #PB_Key_1
    #PB_Key_2
    #PB_Key_3
    #PB_Key_4
    #PB_Key_5
    #PB_Key_6
    #PB_Key_7
    #PB_Key_8
    #PB_Key_9
    #PB_Key_0

    #PB_Key_A
    #PB_Key_B
    #PB_Key_C
    #PB_Key_D
    #PB_Key_E
    #PB_Key_F
    #PB_Key_G
    #PB_Key_H
    #PB_Key_I
    #PB_Key_J
    #PB_Key_K
    #PB_Key_L
    #PB_Key_M
    #PB_Key_N
    #PB_Key_O
    #PB_Key_P
    #PB_Key_Q
    #PB_Key_R
    #PB_Key_S
    #PB_Key_T
    #PB_Key_U
    #PB_Key_V
    #PB_Key_W
    #PB_Key_X
    #PB_Key_Y
    #PB_Key_Z

    #PB_Key_Escape
    #PB_Key_Minus
    #PB_Key_Equals
    #PB_Key_Back
    #PB_Key_Tab
    #PB_Key_LeftBracket
    #PB_Key_RightBracket
    #PB_Key_Return
    #PB_Key_LeftControl
    #PB_Key_SemiColon
    #PB_Key_Apostrophe
    #PB_Key_Grave
    #PB_Key_LeftShift
    #PB_Key_BackSlash
    #PB_Key_Comma
    #PB_Key_Period
    #PB_Key_Slash
    #PB_Key_RightShift
    #PB_Key_Multiply
    #PB_Key_LeftAlt
    #PB_Key_Space
    #PB_Key_Capital
    #PB_Key_F1
    #PB_Key_F2
    #PB_Key_F3
    #PB_Key_F4
    #PB_Key_F5
    #PB_Key_F6
    #PB_Key_F7
    #PB_Key_F8
    #PB_Key_F9
    #PB_Key_F10
    #PB_Key_F11
    #PB_Key_F12
    #PB_Key_NumLock
    #PB_Key_Scroll
    #PB_Key_Pad0
    #PB_Key_Pad1
    #PB_Key_Pad2
    #PB_Key_Pad3
    #PB_Key_Pad4
    #PB_Key_Pad5
    #PB_Key_Pad6
    #PB_Key_Pad7
    #PB_Key_Pad8
    #PB_Key_Pad9
    #PB_Key_Add
    #PB_Key_Subtract
    #PB_Key_Decimal
    #PB_Key_PadEnter
    #PB_Key_RightControl
    #PB_Key_PadComma
    #PB_Key_Divide
    #PB_Key_RightAlt
    #PB_Key_Pause
    #PB_Key_Home
    #PB_Key_Up
    #PB_Key_Down
    #PB_Key_Left
    #PB_Key_Right
    #PB_Key_End
    #PB_Key_PageUp
    #PB_Key_PageDown
    #PB_Key_Insert
    #PB_Key_Delete

Supported OS

All

<- KeyboardMode() - Keyboard Index - KeyboardReleased() ->