mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-25 08:33:27 +00:00
Wave animation
This commit is contained in:
parent
03b53c6a75
commit
01aaed54d6
@ -128,4 +128,5 @@ enum class BackgroundAnimation {
|
||||
OFF = 0,
|
||||
FLOATING_SYMBOLS = 1,
|
||||
RECENT_GAMES = 2,
|
||||
WAVE = 3,
|
||||
};
|
||||
|
@ -880,7 +880,7 @@ void GameSettingsScreen::CreateViews() {
|
||||
if (backgroundChoice_ != nullptr) {
|
||||
backgroundChoice_->OnClick.Handle(this, &GameSettingsScreen::OnChangeBackground);
|
||||
}
|
||||
static const char *backgroundAnimations[] = { "No animation", "Floating symbols", "Recent games" };
|
||||
static const char *backgroundAnimations[] = { "No animation", "Floating symbols", "Recent games", "Waves" };
|
||||
systemSettings->Add(new PopupMultiChoice(&g_Config.iBackgroundAnimation, sy->T("UI background animation"), backgroundAnimations, 0, ARRAY_SIZE(backgroundAnimations), sy->GetName(), screenManager()));
|
||||
|
||||
systemSettings->Add(new ItemHeader(sy->T("Help the PPSSPP team")));
|
||||
|
@ -79,6 +79,32 @@ public:
|
||||
virtual void Draw(UIContext &dc, double t, float alpha) = 0;
|
||||
};
|
||||
|
||||
class WaveAnimation : public Animation {
|
||||
public:
|
||||
void Draw(UIContext &dc, double t, float alpha) override {
|
||||
const uint32_t color = 0x30FFFFFF;
|
||||
const float speed = 1.0;
|
||||
|
||||
Bounds bounds = dc.GetBounds();
|
||||
dc.Flush();
|
||||
dc.BeginNoTex();
|
||||
|
||||
t *= speed;
|
||||
for (int x = 0; x < bounds.w; ++x) {
|
||||
float i = x * 1280/bounds.w;
|
||||
|
||||
float wave0 = sin(i*0.005+t*0.8)*0.05 + sin(i*0.002+t*0.25)*0.02 + sin(i*0.001+t*0.3)*0.03 + 0.625;
|
||||
dc.Draw()->RectVGradient(x, wave0*bounds.h, pixel_in_dps_x, (1.0-wave0)*bounds.h, color, 0x00000000);
|
||||
|
||||
float wave1 = sin(i*0.0044+t*0.4)*0.07 + sin(i*0.003+t*0.1)*0.02 + sin(i*0.001+t*0.3)*0.01 + 0.625;
|
||||
dc.Draw()->RectVGradient(x, wave1*bounds.h, pixel_in_dps_x, (1.0-wave1)*bounds.h, color, 0x00000000);
|
||||
}
|
||||
|
||||
dc.Flush();
|
||||
dc.Begin();
|
||||
}
|
||||
};
|
||||
|
||||
class FloatingSymbolsAnimation : public Animation {
|
||||
public:
|
||||
~FloatingSymbolsAnimation() override {}
|
||||
@ -236,6 +262,9 @@ void DrawBackground(UIContext &dc, float alpha) {
|
||||
case BackgroundAnimation::RECENT_GAMES:
|
||||
g_Animation.reset(new RecentGamesAnimation());
|
||||
break;
|
||||
case BackgroundAnimation::WAVE:
|
||||
g_Animation.reset(new WaveAnimation());
|
||||
break;
|
||||
default:
|
||||
g_Animation.reset(nullptr);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user