Double click

Hey all, again.

I was wondering, how can I treat double-clicks using glut? I was trying to do a zoom function for my Julia set with the double-click, but I can’t get anything to work…

Hi

I don’t know if there is a special handle for double click,but
I can offer you a workaround until you find a better solution (if there is one)
Use regular one click event and count clicks - every second click reset the counter and code must be smth like this:

void processMouse(int mouseButton, int mouseState, int x, int y)
{
if (mouseState == GLUT_DOWN)
{
if (mouseButton == GLUT_LEFT_BUTTON)// GLUT_MIDDLE_BUTTON or GLUT_RIGHT_BUTTON
{
CountClicks++;
if(CountClicks == 2)
{
// your code…
CountClicks = 0;
}
}

}

And you must add in your main init this
glutMouseFunc(processMouse);

Hope this helps.