Mouse Double Click extension for GameMaker Studio provides double-click detection

Mouse Double Click is an Extension that provides two new GML functions, mouse_doubleclick_init() and mouse_check_doubleclick() 

Written in pure GML, these new functions round out the built-in Mouse functions, allowing you to easily check for double-click events.

Mouse Doubleclick demo.

To use it, first call the mouse_doubleclick_init() function in the Create event for the object that will be handling click actions. This creates an instance variable used to perform timing checks for the double-click, like so:

//Create Event:

In a Step or Mouse event, call mouse_check_doubleclick(), passing in parameters for the mouse button to test for, and the doubleclick delay in microseconds (1/1,000,000th of a second).

//Mouse Event
mouse_check_doubleclick(mb_left, 250000); //250000 microseconds = 1/4 of a second

mouse_check_doubleclick() will return true if there were two clicks within the duration specified by the second argument, and false if no double click is detected.

That’s all there is to it.

Updated: 2019-May-31 — 2:38 pm

Leave a Reply