Detect Double Click


👉 BlitzCoder will be building a new platform and other plans to preserve and continue the Blitz legacy.

To be able to achieve this goal, we need your support by becoming a Patreon Paid Member 👈

 

Tweet blitz3d blitzplus input code-archives tutorials
BlitzCoder

Quick example and tutorial on how to detect double clicks.

Doubleclicktime=250 ;rate or wait time in millisecs

Repeat

Doubleclick1=False
click1=False
Time=MilliSecs()
If MouseDown(1) Then
    mousedown1 = True
Else    
    If  mousedown1 Then ; if we get here mouse button has been released
        Clicktime1 = Time
        If Clicktime1-Lastclicktime1 <= Doubleclicktime Then
            Doubleclick1=True 
            Lastclicktime1=0 : Wait1time=0
        Else
            If  Wait1time=0 Then Wait1time = Clicktime1 + doubleclicktime
            Lastclicktime1 = Clicktime1
        EndIf
        mousedown1 = False
    EndIf   
EndIf
If Wait1time > 0 And Time > Wait1time Then Click1 = True :  Wait1time=0

If Click1 Then click1count=click1count+1 : Print clicktime1+" singleclick "+click1count
If doubleclick1 Then double1count=double1count+1 : Print Clicktime1+" Doubleclick! "+double1count

Until KeyDown(1)

End

Reply To Topic (minimum 10 characters)

Please log in to reply