Example #1
0
void keyfunc(unsigned char key, int x, int y) {
  key = toupper(key);
  switch (key) {
  case '+':
    increment_speed *= 1.5;
    break;
  case '-':
    increment_speed *= 2.0/3.0;
    break;
  case 'Q': 
    exit(0);
    break;
  case 'S':
    alternate_spinning();
    break;
  case 'F':
    /* 
       Freeze the azimuth and elevation until the next time the 
       f key is pressed.
    */
    alternate_freezing();
    /* if we just unfroze, go ahead and recalc the view so the user
       doesn't have to move the mouse to get a redraw from the current
       mouse position */
    if (!frozenp()) {
      ae_passive_mouse_motion(x, y);
      glutSetWindow(ae_win);
      glutPostRedisplay();
      glutSetWindow(disp_win);
    }
    break;
  case 'R':
    /*reset view*/
    init_look();
    increment_speed = 1.0;
  default:
    break;
  }
  glutSetWindow(disp_win);
}
Example #2
0
void keyfunc(unsigned char key, int x, int y) {
  key = toupper(key);
  switch (key) {
  case '+':
    increment_speed *= 1.5;
    break;
  case '-':
    increment_speed *= 2.0/3.0;
    break;
  case 'Q':
    exit(0);
    break;
  case 'S':
    alternate_spinning();
    break;
  case 'A':
    AEGraph_is_in_disp_win = !AEGraph_is_in_disp_win;
    glutSetWindow(disp_win);
    glutPostRedisplay();
    break;
  case 'B':
    compass_is_in_disp_win = !compass_is_in_disp_win;
    glutSetWindow(compass_win);
    glutPostRedisplay();
    glutSetWindow(disp_win);
    break;
  case 'C':
    toggle_compass_window(); /* create it if it doesn't exist,
				destroy it if it does exist. */
    break;
  case 'F':
    /* 
       Freeze the azimuth and elevation until the next time the 
       f key is pressed.
    */
    alternate_freezing();
    /* if we just unfroze, go ahead and recalc the view so the user
       doesn't have to move the mouse to get a redraw from the current
       mouse position */
    if (!frozenp()) {
      ae_passive_mouse_motion(x, y);
      glutSetWindow(ae_win);
      glutPostRedisplay();
      glutSetWindow(disp_win);
    }
    break;
  case 'R':
    /*reset view*/
    init_look();
    increment_speed = 1.0;
    break;
  case 'G':
    if(reality_mode == 0) {
      reality_mode = 1;
      glutIdleFunc(idle);
    } else {
      reality_mode = 0;
      if(action == 0) glutIdleFunc(NULL);
    }
    break;
  default:
    break;
  }
  glutSetWindow(disp_win);
}