Ejemplo n.º 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);
}
Ejemplo n.º 2
0
/* Note: if compiling with Win32 be sure to use /subsystem:windows and
 * /entry:mainCRTStartup
 */
int main(int argc, char *argv[]) {
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowPosition(0,0);
	glutInitWindowSize(INIT_WIN_W, INIT_WIN_H);
	disp_win = glutCreateWindow("QuasiPseudoSorta FlightSim");
	glutDisplayFunc(display);
	glutKeyboardFunc(keyfunc);
	glutMouseFunc(mouse_button);
	glutMotionFunc(track_motion);
	glutReshapeFunc(reshape);
	glutVisibilityFunc(vis); /* don't do idle things if they aren't seen */

	set_initial_size(INIT_WIN_W, INIT_WIN_H, INIT_AE_WIN_W, INIT_AE_WIN_H);
	init_look();
	spin_init();
	scene_init();
	glutSetWindow(disp_win);
	glutMainLoop();

	return 0; /* we'll never get here, of course */
}
Ejemplo n.º 3
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);
}