static void nyth_light_effects_frame_init(NythLightEffectsFrame *frame) { NythLightEffectsFramePrivate *priv = NYTH_LIGHT_EFFECTS_FRAME_GET_PRIVATE(frame); GtkBox *box; frame->priv = priv; box = GTK_BOX(gtk_vbox_new(FALSE, 0)); add_radios_color_effect(box, frame); gtk_box_pack_start(box, gtk_hseparator_new(), TRUE, TRUE, 0); add_radios_light_effect(box, frame); gtk_box_pack_start(box, gtk_hseparator_new(), TRUE, TRUE, 0); add_speed(box, frame); gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(box)); gtk_frame_set_label(GTK_FRAME(frame), _("Light effects")); }
void Ball::move(SDL_Rect* player1, SDL_Rect* player2) { m_BRect.x += velocity_x(); m_BRect.y += velocity_y(); // Detecting the collision in the Y axis. if(m_BRect.y <= 0) { velocity_y(-m_ball_speed.y()); m_last_ball_speed = m_ball_speed; } if(m_BRect.y+m_BRect.h > Window::get_height()) { velocity_y(-m_ball_speed.y()); m_last_ball_speed = m_ball_speed; } // Detecting the collision with the players. if(collision(player1)) { if (m_BRect.x + abs(velocity_x()) < player1->x + player1->w) { velocity_y(-m_ball_speed.y()); } else { if (Paddle::get_hits() == 3) { add_speed(); velocity_x(-m_ball_speed.x()); Paddle::reset_hit_count(); } else { velocity_x(-m_ball_speed.x()); } } m_last_ball_speed = m_ball_speed; if(Game::audio->is_open()) { Game::audio->play_effect(Audio::EffectType::hit_paddle); } Debug::log("Hit count: ", Paddle::get_hits()); Paddle::add_hit(); } if(collision(player2)) { if ((m_BRect.x + m_BRect.w)-velocity_x() > player2->x) { velocity_y(-m_ball_speed.y()); } else { velocity_x(-m_ball_speed.x()); if(Paddle::get_hits() == 3) { add_speed(); Paddle::reset_hit_count(); } else { } } m_last_ball_speed = m_ball_speed; if(Game::audio->is_open()) { Game::audio->play_effect(Audio::EffectType::hit_paddle); } Debug::log("Hit count: ", Paddle::get_hits()); Paddle::add_hit(); } }