author | Don Pellegrino <don@drexel.edu> | 2009-06-16 23:23:48 (GMT) |
---|---|---|
committer | Don Pellegrino <don@drexel.edu> | 2009-06-16 23:23:48 (GMT) |
commit | 8f889f22d854704ea4f472bb950daf2fdb15385b (patch) (side-by-side diff) | |
tree | e016d315f71075bcc4261dcf8439995bbdba96a4 | |
parent | 0577eee8222645991f8cc68289f6be3bfd0e4d26 (diff) | |
download | exp005-8f889f22d854704ea4f472bb950daf2fdb15385b.zip exp005-8f889f22d854704ea4f472bb950daf2fdb15385b.tar.gz exp005-8f889f22d854704ea4f472bb950daf2fdb15385b.tar.bz2 |
Added zoom feature - current incomplete.
-rw-r--r-- | src/controller/exp004mouse.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/controller/exp004mouse.c b/src/controller/exp004mouse.c index 8e8f986..72791d5 100644 --- a/src/controller/exp004mouse.c +++ b/src/controller/exp004mouse.c @@ -1,5 +1,6 @@ #include "exp004mouse.h" #include "exp004processhits.h" +#include "exp004reshape.h" #include "../view/exp004geometry.h" #include "../view/exp004state0.h" #include "../util/check_error.h" @@ -17,10 +18,31 @@ exp004mouse (int button, int state, int x, int y) { if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) { + if (S.selecting == true && S.zoom == true) + { + GLint viewport[4]; + glGetIntegerv (GL_VIEWPORT, viewport); + + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + + /* + * Convert the selection boundary from window coordinates to + * world coordinates. + */ + + gluOrtho2D(-20.0, + 20.0, + -20.0, + 20.0); + + glutPostRedisplay (); + } + /* * Complete a selection if one was started and not cancelled. */ - if (S.selecting == true) + if (S.selecting == true && S.zoom == false) { /* @@ -57,14 +79,6 @@ exp004mouse (int button, int state, int x, int y) GLint viewport[4]; glGetIntegerv (GL_VIEWPORT, viewport); - /* - gluPickMatrix ((GLdouble) x, - (GLdouble) (viewport[3] - y), - N, - N, - viewport); - */ - double c_x = 0.0; double c_y = 0.0; double w = 0.0; |