TrainView::TrainView(int x, int y, int w, int h, const char* l) : Fl_Gl_Window(x,y,w,h,l) { mode( FL_RGB|FL_ALPHA|FL_DOUBLE | FL_STENCIL ); resetArcball(); curveMode = CurveModeCatmull; trackMode = TrackModeNormal; trainHeadPoint = NULL; trainHeadTarget = NULL; }
/******************************************************************************* Function that gets called for any keypresses. *******************************************************************************/ void myKey(unsigned char key, int x, int y) { float time; const double speed = 1.0; switch (key) { case 'q': case 27: exit(0); case 's': g_frameSaver.DumpPPM(g_width,g_height); break; case 'x': addRandomFoodParticle( 100, &World, &Space ); animator.scanForFood( animator.foodParticles.back() ); break; case 'r': resetArcball(); break; case '1': animator.active = !animator.active; break; case 'a': g_animate = 1 - g_animate; //Reset the timer to point to the current time. time = g_timer.GetElapsedTime(); g_timer.Reset(); break; case '0': //Reset your object. break ; case 'm': if( g_recording == 1 ) { std::cout << "Frame recording disabled." << std::endl; g_recording = 0; } else { std::cout << "Frame recording enabled." << std::endl; g_recording = 1 ; } g_frameSaver.Toggle(); break ; case 'h': case '?': GDrawing::plotInstructions(); break; } glutPostRedisplay(); }
void myKey(unsigned char key, int x, int y) { float time ; switch (key) { case 'q': case 27: exit(0); case 's': FrSaver.DumpPPM(Width,Height) ; break; case 'r': resetArcball() ; glutPostRedisplay() ; break ; case 'a': // togle animation Animate = 1 - Animate ; // reset the timer to point to the current time time = TM.GetElapsedTime() ; TM.Reset() ; // printf("Elapsed time %f\n", time) ; break ; case '0': //reset your object break ; case 'm': if( Recording == 1 ) { printf("Frame recording disabled.\n") ; Recording = 0 ; } else { printf("Frame recording enabled.\n") ; Recording = 1 ; } FrSaver.Toggle(Width); break ; case 'h': case '?': instructions(); break; } glutPostRedisplay() ; }
TrainView::TrainView(int x, int y, int w, int h, const char* l) : Fl_Gl_Window(x,y,w,h,l) { mode( FL_RGB|FL_ALPHA|FL_DOUBLE | FL_STENCIL ); resetArcball(); }
void KeyboardCB(unsigned char key, int x, int y) { switch (key) { case 'q': case 27: exit(0); case 'f': // take a snapshot in ppm format g_frameSaver.DumpPPM(g_width,g_height) ; break; case 't': resetTime() ; break ; case 'r': resetArcball() ; Reset() ; g_zoom = 1 ; glutPostRedisplay() ; break ; case 'a': // toggle animation state if( g_state == STATE_ANIMATE ) { g_state = STATE_IDLE ; } else { resetTime() ; g_state = STATE_ANIMATE ; } break ; case 's': // togle simulation state if( g_state == STATE_SIMULATE ) { g_state = STATE_IDLE ; } else { resetTime() ; InitSimulation() ; g_state = STATE_SIMULATE ; } break ; case 'p': // togle playback if( g_state == STATE_PLAYBACK ) { g_state = STATE_IDLE ; } else { g_state = STATE_PLAYBACK ; } break ; case '0': //reset your object break ; case 'm': // toggle frame dumping if( g_frameDumping == 1 ) { animTcl::OutputMessage("Frame Frame Dumping disabled.\n") ; g_frameDumping = 0 ; } else { animTcl::OutputMessage("Frame Frame Dumping enabled.\n") ; g_frameDumping = 1 ; } g_frameSaver.Toggle(g_width); break ; case 'h': case '?': instructions(); break; } myKey(key, x, y) ; glutPostRedisplay() ; }