• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows double click duration system value ?

DaveInDev

Member
Hi,
I understood that there is no builtin double_click detection in GSM2 (despite the weird "device_mouse_dbclick_enable" function).
So I can program one, it's not a problem.
But to be consistent with user's environment, I'd like to read the OS (Windows) default double click duration.
Do you have an idea how to do that ?
 

rytan451

Member
For windows, you can use the Windows API to get the double click time. winuser.h defines the method UINT GetDoubleClickTime(), which returns the double click duration in milliseconds. If you create a C file that imports winuser.h and exposes GetDoubleClickTime, you can compile a DLL and use it as an extension. Using that extension, you should be able to query the OS for double click duration.

Here's a quick mockup of the code:

C:
// DoubleClickInterface.c
#include <winuser.h>
#define gmexport __declspec(dllexport)

gmexport double gm_DoubleClickTime() {
  return (double) GetDoubleClickTime();
}
Then you can compile with the requisite flags (google them), import the resulting DLL into your project, and create the links for the function.
 

DaveInDev

Member
Thanks. I'm not used to making extensions yet, nor DLL, but I'll try it. Do you know a good tuto that treats the subject of writing a DLL extension for GMS2 ?
 
Top