diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 5806a646a5..ada5e9e4e9 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -15,6 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include + #include "base/colorutil.h" #include "base/timeutil.h" #include "file/path.h" @@ -186,9 +188,27 @@ void GameButton::Draw(UIContext &dc) { dc.RebindTexture(); dc.SetFontStyle(dc.theme->uiFont); if (!gridStyle_) { + float tw, th; dc.Draw()->Flush(); dc.PushScissor(bounds_); - dc.DrawText(ginfo->title.c_str(), bounds_.x + 150, bounds_.centerY(), style.fgColor, ALIGN_VCENTER); + + dc.MeasureText(dc.GetFontStyle(), ginfo->title.c_str(), &tw, &th, 0); + + int availableWidth = bounds_.w - 150; + float sineWidth = std::max(0.0f, (tw - availableWidth)) / 2.0f; + + float tx = 150; + if (availableWidth < tw) { + tx -= (1.0f + sin(time_now_d() * 1.5f)) * sineWidth; + Bounds tb = bounds_; + tb.x = bounds_.x + 150; + tb.w = bounds_.w - 150; + dc.PushScissor(tb); + } + dc.DrawText(ginfo->title.c_str(), bounds_.x + tx, bounds_.centerY(), style.fgColor, ALIGN_VCENTER); + if (availableWidth < tw) { + dc.PopScissor(); + } dc.Draw()->Flush(); dc.PopScissor(); } else if (!texture) { diff --git a/native b/native index d2e70ce06f..1d28b00536 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit d2e70ce06fd54e0c884afe8d8b876ae28ce16df0 +Subproject commit 1d28b00536a7366e00ce900547e01a9d4b2914ee