KeyboardPushed()
Syntaxe
Resultat = KeyboardPushed(ToucheID)Description
Teste l'état enfoncé ou non d'une touche du clavier.
Arguments
ToucheID L'identifiant PureBasic de la touche à tester.
Valeurs possibles:#PB_Key_All ; Toutes les touches sont testées. ; Utile pour coder un "Appuyer sur une touche..." #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
Valeur de retour
Renvoie une valeur non nulle si la touche est pressée, zéro sinon.
Remarques
- Un nombre quelconque de touches peut être pressé simultanément.
- Si vous voulez tester si une touche spécifique a été appuyée puis relâchée, utiliser la commande KeyboardReleased().
- La fonction ExamineKeyboard() doit être appelée avant pour mettre à jour l'état du clavier.
- Le comportement du clavier peut être changé avec la commande KeyboardMode().
Exemple
If InitSprite() And InitKeyboard() And OpenScreen(800,600,16,"") Repeat FlipBuffers() If StartDrawing(ScreenOutput()) DrawText(0, 0, "Appuyez sur la touche [Echap] pour quitter") StopDrawing() EndIf ExamineKeyboard() If KeyboardPushed(#PB_Key_Escape) ; Appuyez sur la touche [Echap] pour quitter End EndIf ForEver EndIf
Voir aussi
ExamineKeyboard(), KeyboardInkey(), KeyboardReleased()
OS Supportés
Tous