Jump to content
  • Advertisement
Sign in to follow this  
grayaii

Double-click with glut (resurrecting old post)

This topic is 3687 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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... :)

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!