Update glpuzzle demo to work with two button mice.

git-svn-id: file:///fltk/svn/fltk/trunk@169 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 1998-12-29 13:34:35 +00:00
parent 06113fb95e
commit cbd4a28132
1 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
// //
// "$Id: glpuzzle.cxx,v 1.4 1998/12/08 21:04:40 mike Exp $" // "$Id: glpuzzle.cxx,v 1.5 1998/12/29 13:34:35 mike Exp $"
// //
// OpenGL puzzle demo for the Fast Light Tool Kit (FLTK). // OpenGL puzzle demo for the Fast Light Tool Kit (FLTK).
// //
@ -1267,7 +1267,10 @@ mouse(int b, int s, int x, int y)
} }
left_mouse = GL_TRUE; left_mouse = GL_TRUE;
sel_piece = selectPiece(mousex, mousey); sel_piece = selectPiece(mousex, mousey);
if (computeCoords(sel_piece, mousex, mousey, &selx, &sely)) { if (!sel_piece) {
left_mouse = GL_FALSE;
middle_mouse = GL_TRUE; // let it rotate object
} else if (computeCoords(sel_piece, mousex, mousey, &selx, &sely)) {
grabPiece(sel_piece, selx, sely); grabPiece(sel_piece, selx, sely);
} }
glutPostRedisplay(); glutPostRedisplay();
@ -1278,16 +1281,13 @@ mouse(int b, int s, int x, int y)
break; break;
} }
} else { } else {
switch (b) { if (left_mouse) {
case GLUT_LEFT_BUTTON:
left_mouse = GL_FALSE; left_mouse = GL_FALSE;
dropSelection(); dropSelection();
glutPostRedisplay(); glutPostRedisplay();
break; } else if (middle_mouse) {
case GLUT_MIDDLE_BUTTON:
middle_mouse = GL_FALSE; middle_mouse = GL_FALSE;
glutPostRedisplay(); glutPostRedisplay();
break;
} }
} }
motion(x, y); motion(x, y);
@ -1479,5 +1479,5 @@ main(int argc, char **argv)
#endif // added for fltk's distribution #endif // added for fltk's distribution
// //
// End of "$Id: glpuzzle.cxx,v 1.4 1998/12/08 21:04:40 mike Exp $". // End of "$Id: glpuzzle.cxx,v 1.5 1998/12/29 13:34:35 mike Exp $".
// //