X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lsystem3d%2Fsrc%2Fcallbacks.cpp;fp=lsystem3d%2Fsrc%2Fcallbacks.cpp;h=0000000000000000000000000000000000000000;hb=db873ae7535fc6bde3c61d7d0e6346797c658477;hp=b4437b2300c23b4132bbe99256d5b14299536296;hpb=e5247a3b88c449937af08f46afc271afda2954a2;p=lsystem3d.git diff --git a/lsystem3d/src/callbacks.cpp b/lsystem3d/src/callbacks.cpp deleted file mode 100644 index b4437b2..0000000 --- a/lsystem3d/src/callbacks.cpp +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (C) 2006 Erik Dahlberg -// -// This file is part of LSystem3d. -// -// LSystem3D is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// LSystem3D is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with LSystem3D; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - - - -#include - -#include - -#include "callbacks.h" -#include "openglwindow.h" - -extern OpenGLWindow *openglWindow; - - - -// GLUT callback functions -// ----------------------- - -/** - * Key press - * @param key the key - * @param x mouse x-coordinate - * @param y mouse y-coordinate - */ -void glutKeyboardCB(unsigned char key, int x, int y) -{ - switch (key) - { - // quit - case 27: // escape key - glutLeaveMainLoop(); - break; - - // zoom in - case '+': - openglWindow->zoomIn(); - break; - - // zoom out - case '-': - openglWindow->zoomOut(); - break; - - // rotate around the y-axis - case 'y': - case 'Y': - openglWindow->rotateY(); - - default: - break; - } -} - - - -/** - * Special key press - * @param key the key - * @param x mouse x-coordinate - * @param y mouse y-coordinate - */ -void glutSpecialCB(int key, int x, int y) -{ - switch (key) - { - // move camera left - case GLUT_KEY_LEFT: - openglWindow->left(); - break; - - // move camera right - case GLUT_KEY_RIGHT: - openglWindow->right(); - break; - - // move camera up - case GLUT_KEY_UP: - openglWindow->up(); - break; - - // move camera down - case GLUT_KEY_DOWN: - openglWindow->down(); - break; - - // move camera forth - case GLUT_KEY_PAGE_UP: - openglWindow->forth(); - break; - - // move camera back - case GLUT_KEY_PAGE_DOWN: - openglWindow->back(); - break; - - default: - break; - } -} - - - -/** - * Redraw of screen - */ -void glutDisplayCB() -{ - openglWindow->draw(); -} - - - -/** - * Idling - */ -void glutIdleCB() -{ - // spare some cpu cycles - usleep(1); -} - - - -// GLUI callback functions -// ----------------------- - -/** - * Angle changes - * @param id not used - */ -void gluiSpinnerAngleCB(int id) -{ - // regenerate and draw l-system only if "live mode" is enabled - - if (openglWindow->liveActivated()) - { - openglWindow->generate(); - glutPostRedisplay(); - } -} - - - -/** - * Reset button pressed - * @param id not used - */ -void gluiButtonResetCB(int id) -{ - // place camera at initial position - openglWindow->defaultView(); -} - - - -/** - * Generate button pressed - * @param id not used - */ -void gluiButtonGenerateCB(int id) -{ - openglWindow->generate(); -}