View Full Version : glutTimerFunc & double clicking
06-17-2003, 05:01 AM
1. I have a question about glutTimerFunc.
2. I want to use it to determine if a user has registered a double click or not.
3. I've set that 2 milliseconds should the max time between clicks for it to be registered as a double click.
4. How do I find out if the second click has been registered within 2 milliseconds?
06-17-2003, 06:27 AM
on the first click, call glutTimerFunc and set a boolean variable (waiting_for_another_click) to true.
on the second click, if waiting_for_another_click==true then that were a double click.
obviously, you have to reset waiting_for_another_click to false when the timer func is called.
2 milliseconds is very short. try 250 milliseconds instead.
06-17-2003, 07:02 PM
1. Thanks for the reply.
2. I have initialiaed glutTimerFunc() in the main function, is that ok?
3. What should be the value of *value* in
"glutTimerFunc(unsigned int msecs, void (*func)(int value), value); "
06-17-2003, 10:28 PM
you have to call glutTimerFunc each time you want to check a double click, not just in the main function
the value parameter is passed to the callback at the end of msecs milliseconds.
using this value, you are able to define mutliple timer which use the same function but according to value, perform different operations.
you should take a look at: http://www.opengl.org/developers/documentation/glut/spec3/spec3.html
for glut version 3 specification
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.