hi
is there a way to detect double mouse clicks?
thanks
opengl: how to detect double click?
No - OpenGL is for graphics only, not input.
Perhaps you mean GLUT or something similar instead?
Perhaps you mean GLUT or something similar instead?
No - OpenGL is for graphics only, not input.
Perhaps you mean GLUT or something similar instead?
yes, i meant glut
thanks
GLUT doesn't provide double click detection out of the box. You need to manually time single clicks to detect a double click. This is another thread discussing this idea.
GLUT doesn't provide double click detection out of the box. You need to manually time single clicks to detect a double click. This is another thread discussing this idea.
hi,
thanks for the reply. i wonder can i get the coordinate (window x & y values) where the double clicks occurred? i need that info for my program to work.
thanks
hi,
how do i differentiate a single click and a double click?
let's see my subroutine for handling mouse click:
void mouseButton(int button, int state, int x, int y) {
switch (button) {
case GLUT_LEFT_BUTTON:
if (state == GLUT_UP) {
xpos = W[C].l+(GLdouble)x*deltax-0.5*swx_size,
ypos = W[C].t-(GLdouble)y*deltay-0.5*swy_size;
move_cursor();
}
break;
default:
break;}
}
i am complete lost in implementing glutTimerFunc(). i am still looking at other's tutorials. i only want to execute move_cursor() when there is a single click and execute Zoom_in() when it is a double click. where should i place glutTimerFunc()? before move_cursor()?
thanks
how do i differentiate a single click and a double click?
let's see my subroutine for handling mouse click:
void mouseButton(int button, int state, int x, int y) {
switch (button) {
case GLUT_LEFT_BUTTON:
if (state == GLUT_UP) {
xpos = W[C].l+(GLdouble)x*deltax-0.5*swx_size,
ypos = W[C].t-(GLdouble)y*deltay-0.5*swy_size;
move_cursor();
}
break;
default:
break;}
}
i am complete lost in implementing glutTimerFunc(). i am still looking at other's tutorials. i only want to execute move_cursor() when there is a single click and execute Zoom_in() when it is a double click. where should i place glutTimerFunc()? before move_cursor()?
thanks
Generally speaking, a "single click" event will always be fired off before the "double click" event. In Actionscript 3, a double click causes two events to be fired, what you need to do is code in such away that the action being done on the single click even naturally flows into the double click event. For example, single clicking a unit may select that particular one but double click it will select all units of that type. The flow works naturally as the first click event will select it and then the double click event will notice that the unit is selected and then search the rest of the game world for units of the same type to select.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement