Here is example code:
Code: Select all
@DISPLAY {Width=1920, Height=1080, ScaleMode = #SCALEMODE_AUTO, FitScale = True}
EscapeQuit(True)
Function ClickToContinue(timetowait)
waitformousebuttonstogoup()
Local skip = False
While skip = False
If IsLeftMouse()= True Or IsRightMouse() = True Then skip = True
Wend
EndFunction
Function waitformousebuttonstogoup()
Local skip=False
While skip=False
VWait()
If IsLeftMouse() = False And IsRightMouse() = False Then skip=True
Wend
EndFunction
Function startgame()
DebugPrint("button active")
End()
EndFunction
Function p_Init_TitleScreen()
Cls()
waitformousebuttonstogoup()
TextOut(100, 100, "mouse buttons are up now")
MakeButton(1, #SIMPLEBUTTON, 1 , 1, 1920, 1080, {OnMouseUp = Function() StartGame() EndFunction})
EndFunction
Cls(#BLACK)
TextOut(#CENTER, 100, "<CLICK MOUSE TO CONTINUE>")
ClickToContinue(0)
Cls(#BLACK)
p_init_titlescreen()
Repeat
WaitEvent()
Forever
However, at least on my windows 10 machine, when i click, it activates this button right away.
If i click with right mouse button, it works fine (since left mouse button havent been pressed), but clicking left mouse button, and despite there being code checking that this mouse button is released before button is made and waitevent happens, it seems to still activate this OnMouseUp event.
You can also check by holding left mouse button down to see that it doesnt move forward until button is actually released, at which point you can see for a moment that new text appearing to screen, to see that it is not moving forward until button is released.