Fix a couple sort comparators for the savedata screen

This commit is contained in:
Henrik Rydgård 2021-09-10 01:13:01 +02:00
parent f9f893f3fc
commit 85ac0f8856

View file

@ -317,13 +317,13 @@ void SavedataButton::Draw(UIContext &dc) {
int availableWidth = bounds_.w - 150;
float sineWidth = std::max(0.0f, (tw - availableWidth)) / 2.0f;
float tx = 150;
float tx = 150.0f;
if (availableWidth < tw) {
float overageRatio = 1.5f * availableWidth * 1.0f / tw;
tx -= (1.0f + sin(time_now_d() * overageRatio)) * sineWidth;
Bounds tb = bounds_;
tb.x = bounds_.x + 150;
tb.w = bounds_.w - 150;
tb.x = bounds_.x + 150.0f;
tb.w = std::max(1.0f, bounds_.w - 150.0f);
dc.PushScissor(tb);
}
dc.DrawText(title_.c_str(), bounds_.x + tx, bounds_.y + 4, style.fgColor, ALIGN_TOPLEFT);
@ -443,6 +443,8 @@ bool SavedataBrowser::BySize(const UI::View *v1, const UI::View *v2) {
if (GetTotalSize(b1) > GetTotalSize(b2))
return true;
else if (GetTotalSize(b1) < GetTotalSize(b2))
return false;
return strcmp(b1->GamePath().c_str(), b2->GamePath().c_str()) < 0;
}
@ -469,6 +471,8 @@ bool SavedataBrowser::ByDate(const UI::View *v1, const UI::View *v2) {
if (GetDateSeconds(b1) > GetDateSeconds(b2))
return true;
if (GetDateSeconds(b1) < GetDateSeconds(b2))
return false;
return strcmp(b1->GamePath().c_str(), b2->GamePath().c_str()) < 0;
}