diff --git a/source/application.cpp b/source/application.cpp index 21832f2..db9ea78 100644 --- a/source/application.cpp +++ b/source/application.cpp @@ -1529,7 +1529,8 @@ namespace gmtk void update() override { - float const dt = clock_.restart().count() * time_speed_; + float const frame_dt = clock_.restart().count(); + float const dt = frame_dt * time_speed_ * (in_start_menu_ ? 1.f : (1.f - menu_transition_)); map_.spawn_timer += 3.f * dt; if (map_.spawn_timer >= 1.f) @@ -1818,7 +1819,7 @@ namespace gmtk view_box_[1].min = geom::lerp(from[1].min, to[1].min, t); view_box_[1].max = geom::lerp(from[1].max, to[1].max, t); - view_transition_->timer += dt; + view_transition_->timer += frame_dt; if (view_transition_->timer >= 0.5f) view_transition_ = std::nullopt; } @@ -1902,15 +1903,13 @@ namespace gmtk for (auto & p : card_animation_) { float const target = p.first == active_card_; - p.second += (target - p.second) * (- std::expm1(- 20.f * dt)); + p.second += (target - p.second) * (- std::expm1(- 20.f * frame_dt)); } - menu_transition_ += ((in_menu() ? 1.f : 0.f) - menu_transition_) * (- std::expm1(- 20.f * dt)); + menu_transition_ += ((in_menu() ? 1.f : 0.f) - menu_transition_) * (- std::expm1(- 20.f * frame_dt)); for (int i = 0; i < menu_buttons_.size(); ++i) - { - menu_buttons_[i].selected_state += ((selected_button_ == i ? 1.f : 0.f) - menu_buttons_[i].selected_state) * (- std::expm1(- 20.f * dt)); - } + menu_buttons_[i].selected_state += ((selected_button_ == i ? 1.f : 0.f) - menu_buttons_[i].selected_state) * (- std::expm1(- 20.f * frame_dt)); } void present() override