Files
HollywoodLibs/Examples/Helpers/HL_WaitForAction.hws
2025-05-03 10:00:37 +02:00

34 lines
748 B
Plaintext

/*
************************************************
*** Helpers.hws Example : HL.WaitForAction() ***
************************************************
*/
@INCLUDE "../../+Includes.hws"
@INCLUDE #INC_HELPERS
Function update_callback()
If IsKeyDown("SPACE")
Return(True)
Else
Return(False)
EndIf
EndFunction
Function timeout_callback()
NPrint("TIMED OUT!!!")
EndFunction
NPrint("HL.WaitForAction Example")
NPrint("------------------------\n")
NPrint("Hold down the 'p' key or the left mouse button, timeout is 10 seconds...")
NPrint("SPACE key is used to break the wait loop.")
HL.WaitForAction("p", 25, update_callback, 10000, timeout_callback, Nil)
NPrint("\n--- Left mouse button to quit ---")
Wait(50)
WaitLeftMouse()