Added Helpers library
This commit is contained in:
33
Examples/Helpers/HL_WaitForAction.hws
Normal file
33
Examples/Helpers/HL_WaitForAction.hws
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
************************************************
|
||||
*** 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()
|
Reference in New Issue
Block a user