KeyboardReleased()
语法
Result = KeyboardReleased(KeyID)概要
Checks if the specified key has been pushed and released. This function is useful for switch key checks, like a 'Pause' key in a game (one time the game is paused, next time it will continue). The function ExamineKeyboard() must be called before this function to update the keyboard state. The keyboard behavior can be changed with KeyboardMode().
参数
KeyID The identifier of the key to be checked. For a full list of available keys see KeyboardPushed().
返回值
Nonzero if the specified key has been pushed and released, zero otherwise.
示例
If InitSprite() And InitKeyboard() And OpenScreen(800,600,16,"") Paused = #False Repeat FlipBuffers() If StartDrawing(ScreenOutput()) ExamineKeyboard() If KeyboardReleased(#PB_Key_P) If Paused = #False Paused = #True Else Paused = #False EndIf EndIf DrawingMode(0) If Paused = #False DrawText(20, 20, "Program is running...") Else DrawText(20, 20, "Program paused... ") EndIf StopDrawing() EndIf Until KeyboardPushed(#PB_Key_Escape) EndIf
参阅
ExamineKeyboard(), KeyboardPushed()
已支持操作系统
所有