From aebaeb1070dfa7288d370525faf8b41f25ee4db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 16 Oct 2025 01:14:45 +0200 Subject: [PATCH] Allow dragging the list on the credits screen --- UI/MiscScreens.cpp | 22 +++++++++++++++++++++- UI/MiscScreens.h | 4 ++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 51d2317e6e..2596fb25e8 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -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); diff --git a/UI/MiscScreens.h b/UI/MiscScreens.h index 6135bdd7e8..d6c20c1dfa 100644 --- a/UI/MiscScreens.h +++ b/UI/MiscScreens.h @@ -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 {