void Igc3DView::keyPressEvent ( QKeyEvent * k ) { int n; switch ( k->key() ) { case Qt::Key_R: reset(); break; // case Key_T: // state->flight_trace = (state->flight_trace + 1)%2; // break; case Qt::Key_S: state->flight_shadow = (state->flight_shadow + 1)%2; break; case Qt::Key_B: state->polyhedron_back = (state->polyhedron_back + 1)%2; break; case Qt::Key_F: state->polyhedron_front = (state->polyhedron_front + 1)%2; break; case Qt::Key_Down: n = (int)state->alpha-5; change_alpha(n); break; case Qt::Key_Up: n = (int)state->alpha+5; change_alpha(n); break; case Qt::Key_Left: n = (int)state->gamma+5; change_gamma(n); break; case Qt::Key_Right: n = (int)state->gamma-5; change_gamma(n); break; case Qt::Key_Plus: n = (int)state->mag+2; change_mag(n); break; case Qt::Key_Minus: n = (int)state->mag-2; change_mag(n); break; case Qt::Key_F1: showHelp(); break; } repaint(); }
static void bl_alpha_change(GtkWidget *w, gpointer data) { if (blist) change_alpha(w, blist); }
/* ---------------------------------------------------------------------------- * Draws this particle onto the world. */ void particle::draw() { if(type == PARTICLE_TYPE_SQUARE) { al_draw_filled_rectangle( x - size * 0.5, y - size * 0.5, x + size * 0.5, y + size * 0.5, change_alpha( color, (time / duration) * color.a * 255 ) ); } else if(type == PARTICLE_TYPE_CIRCLE) { al_draw_filled_circle( x, y, size * 0.5, change_alpha( color, (time / duration) * color.a * 255 ) ); } else if(type == PARTICLE_TYPE_BITMAP) { draw_sprite( bitmap, x, y, size, -1, 0, change_alpha( color, (time / duration) * color.a * 255 ) ); } else if(type == PARTICLE_TYPE_PIKMIN_SPIRIT) { draw_sprite( bitmap, x, y, size, -1, 0, change_alpha( color, fabs( sin((time / duration) * M_PI) ) * color.a * 255 ) ); } else if(type == PARTICLE_TYPE_ENEMY_SPIRIT) { float s = sin((time / duration) * M_PI); draw_sprite( bitmap, x + s * 16, y, size, -1, s * M_PI, change_alpha( color, fabs(s) * color.a * 255 ) ); } else if(type == PARTICLE_TYPE_SMACK) { float r = time / duration; float s = size; float opacity = 255; if(r <= 0.5) s *= r * 2; else opacity *= (1 - r) * 2; draw_sprite( bitmap, x, y, s, s, 0, change_alpha(color, opacity) ); } }