Clean up save state preview fade.

Now it mostly matches the save slot text fade.
This commit is contained in:
Unknown W. Brackets 2016-05-27 20:53:58 -07:00
parent e6cf296d1a
commit ac21d2e84d
2 changed files with 10 additions and 3 deletions

View File

@ -811,8 +811,14 @@ void EmuScreen::update(InputState &input) {
}
}
if (time_now_d() - saveStatePreviewShownTime_ > 2 && saveStatePreview_->GetVisibility() == UI::V_VISIBLE) {
saveStatePreview_->SetVisibility(UI::V_GONE);
if (saveStatePreview_->GetVisibility() == UI::V_VISIBLE) {
double endTime = saveStatePreviewShownTime_ + 2.0;
float alpha = clamp_value((endTime - time_now_d()) * 4.0, 0.0, 1.0);
saveStatePreview_->SetColor(colorAlpha(0x00FFFFFF, alpha));
if (time_now_d() - saveStatePreviewShownTime_ > 2) {
saveStatePreview_->SetVisibility(UI::V_GONE);
}
}
}
}

View File

@ -769,7 +769,8 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) {
if (msg == "savestate_displayslot") {
I18NCategory *sy = GetI18NCategory("System");
std::string msg = StringFromFormat("%s: %d", sy->T("Savestate Slot"), SaveState::GetCurrentSlot() + 1);
osm.Show(msg);
// Show for the same duration as the preview.
osm.Show(msg, 2.0f);
}
}