Sign in to follow this  

Double-click with glut (resurrecting old post)

Recommended Posts

Sorry to resurrect an old post (, but I was recently trying to figure out how to capture a double click event with glut, and it turns out you have to keep track of the time in between clicks yourself (per the conclusion of the old post). I just wanted to say that instead of using an arbitrary time (say 500ms), you should be using GetDoubleClickTime (or with .NET, you can use System.Windows.Forms.SystemInformation.DoubleClickTime). That way, your application will have the same feel as the other applications on your OS. So in a nutshell, main() Glut.glutMouseFunc(new Glut.MouseCallback(OnMouseClick)); Foo.myDoubleClickTime = System.Windows.Forms.SystemInformation.DoubleClickTime; private static void OnMouseClick(int buttonPressed, int state, int x, int y) { if(MyMouse.mouseTimeElapsed < Foo.myDoubleClickTime) { // It's a double click! } else { MyMouse.mouseTimeElapsed = 0 // It's a single click. } } I hope this helps anyone who is trying to capture a double click even with glut... :)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this