Skip to main content
GameDev.net gamedev.net
🔒 Locked

Double-click with glut (resurrecting old post)

Started by grayaii Oct 10, 2008 at 9:57 AM 0 replies 3.2k views
Original Post
grayaii
grayaii
Sorry to resurrect an old post (http://www.gamedev.net/community/forums/topic.asp?topic_id=145318), 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... :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.