Allow dragging the list on the credits screen

This commit is contained in:
Henrik Rydgård
2025-10-16 01:14:45 +02:00
parent 230fa1a985
commit aebaeb1070
2 changed files with 25 additions and 1 deletions
+21 -1
View File
@@ -982,6 +982,26 @@ void CreditsScreen::update() {
UpdateUIState(UISTATE_MENU);
}
void CreditsScreen::touch(const TouchInput &touch) {
UIScreen::touch(touch);
if (touch.id != 0)
return;
if (touch.flags & TOUCH_DOWN) {
dragYStart_ = touch.y;
dragYOffsetStart_ = dragOffset_;
}
if (touch.flags & TOUCH_UP) {
dragYStart_ = -1.0f;
}
if (touch.flags & TOUCH_MOVE) {
if (dragYStart_ >= 0.0f) {
dragOffset_ = dragYOffsetStart_ + (touch.y - dragYStart_);
}
}
}
void CreditsScreen::DrawForeground(UIContext &dc) {
auto cr = GetI18NCategory(I18NCat::PSPCREDITS);
@@ -1148,7 +1168,7 @@ void CreditsScreen::DrawForeground(UIContext &dc) {
float t = (float)(time_now_d() - startTime_) * 60.0;
float y = bounds.y2() - fmodf(t, (float)totalHeight);
float y = bounds.y2() - fmodf(t - dragOffset_, (float)totalHeight);
for (int i = 0; i < numItems; i++) {
float alpha = linearInOut(y+32, 64, bounds.y2() - 192, 64);
uint32_t textColor = colorAlpha(dc.GetTheme().infoStyle.fgColor, alpha);
+4
View File
@@ -161,6 +161,7 @@ public:
CreditsScreen();
void update() override;
void DrawForeground(UIContext &ui) override;
void touch(const TouchInput &touch) override;
void CreateViews() override;
@@ -175,6 +176,9 @@ private:
void OnX(UI::EventParams &e);
double startTime_ = 0.0;
double dragYStart_ = -1.0;
double dragOffset_ = 0.0;
double dragYOffsetStart_ = 0.0;
};
class SettingInfoMessage : public UI::LinearLayout {