void zprInit() { getMatrix(); //_zNear =-1.5*boxsize_max; //_zFar = 1.5*boxsize_max; glutReshapeFunc(zprReshape); glutMouseFunc(zprMouse); glutMotionFunc(zprMotion); zprReset(); }
void reb_display_keyboard(unsigned char key, int x, int y){ switch(key){ case 'q': case 'Q': reb_dc.r->status = REB_EXIT_USER; reb_display_exit(&reb_dc); break; case ' ': if (reb_dc.r->status == REB_RUNNING_PAUSED){ printf("Resume.\n"); reb_dc.r->status = REB_RUNNING; }else{ printf("Pause.\n"); reb_dc.r->status = REB_RUNNING_PAUSED; } break; case 's': case 'S': reb_dc.spheres = (reb_dc.spheres+1)%3; break; case 'g': case 'G': reb_dc.ghostboxes = !reb_dc.ghostboxes; break; case 'r': case 'R': zprReset(reb_dc.r->boxsize_max); break; case 'd': case 'D': reb_dc.pause = !reb_dc.pause; break; case 'w': case 'W': reb_dc.wire = !reb_dc.wire; break; case 'c': case 'C': reb_dc.clear = !reb_dc.clear; break; case 'x': reb_dc.reference++; if (reb_dc.reference>reb_dc.r->N) reb_dc.reference = -1; printf("Reference particle: %d.\n",reb_dc.reference); break; case 'X': reb_dc.reference--; if (reb_dc.reference<-1) reb_dc.reference = reb_dc.r->N-1; printf("Reference particle: %d.\n",reb_dc.reference); break; } reb_display(); }
/** * This function is called when the user presses a key. * @param key Character pressed. * @param x Position on screen. * @param y Position on screen. */ void displayKey(unsigned char key, int x, int y){ switch(key){ case 'q': case 'Q': printf("\nProgram ends.\n"); exit(0); break; case ' ': display_pause_sim=!display_pause_sim; if (display_pause_sim){ printf("Pause.\n"); glutIdleFunc(NULL); }else{ printf("Resume.\n"); glutIdleFunc(iterate); } break; case 's': case 'S': display_spheres = !display_spheres; break; case 'g': case 'G': display_ghostboxes = !display_ghostboxes; break; case 'r': case 'R': zprReset(0.85/boxsize_max); break; case 't': case 'T': display_mass = 0; display_tree = !display_tree; break; case 'd': case 'D': display_pause = !display_pause; break; case 'm': case 'M': display_mass = !display_mass; break; case 'w': case 'W': display_wire = !display_wire; break; case 'c': case 'C': display_clear = !display_clear; break; case 'x': display_reference++; if (display_reference>N) display_reference = -1; printf("Reference particle: %d.\n",display_reference); break; case 'X': display_reference--; if (display_reference<-1) display_reference = N-1; printf("Reference particle: %d.\n",display_reference); break; case 'p': case 'P': #ifdef LIBPNG output_png_single("screenshot.png"); printf("\nScreenshot saved as 'screenshot.png'.\n"); #else // LIBPNG printf("\nNeed LIBPNG to save screenshot.\n"); #endif // LIBPNG break; } display(); }