summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>1998-12-29 13:34:35 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>1998-12-29 13:34:35 +0000
commitcbd4a2813272a15c66665af07fe5716fafcecada (patch)
tree0a8e4d857802822aed919da96c9b8851ba0fc5ba
parent06113fb95ec0e4336e4a8f541c831d06e69a85ae (diff)
Update glpuzzle demo to work with two button mice.
git-svn-id: file:///fltk/svn/fltk/trunk@169 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--test/glpuzzle.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/glpuzzle.cxx b/test/glpuzzle.cxx
index 1ccfde39f..b9533e667 100644
--- a/test/glpuzzle.cxx
+++ b/test/glpuzzle.cxx
@@ -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).
//
@@ -1267,7 +1267,10 @@ mouse(int b, int s, int x, int y)
}
left_mouse = GL_TRUE;
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);
}
glutPostRedisplay();
@@ -1278,16 +1281,13 @@ mouse(int b, int s, int x, int y)
break;
}
} else {
- switch (b) {
- case GLUT_LEFT_BUTTON:
+ if (left_mouse) {
left_mouse = GL_FALSE;
dropSelection();
glutPostRedisplay();
- break;
- case GLUT_MIDDLE_BUTTON:
+ } else if (middle_mouse) {
middle_mouse = GL_FALSE;
glutPostRedisplay();
- break;
}
}
motion(x, y);
@@ -1479,5 +1479,5 @@ main(int argc, char **argv)
#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 $".
//