Fix dt in menus & in time sped up
This commit is contained in:
parent
3e55213670
commit
9f892f73a1
1 changed files with 6 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue