diff --git a/assets/romfs/theme/bubble1.png b/assets/romfs/theme/bubble1.png deleted file mode 100644 index ade1b14..0000000 Binary files a/assets/romfs/theme/bubble1.png and /dev/null differ diff --git a/assets/romfs/theme/bubble2.png b/assets/romfs/theme/bubble2.png deleted file mode 100644 index 52e16fa..0000000 Binary files a/assets/romfs/theme/bubble2.png and /dev/null differ diff --git a/assets/romfs/theme/bubble3.png b/assets/romfs/theme/bubble3.png deleted file mode 100644 index 6da1e76..0000000 Binary files a/assets/romfs/theme/bubble3.png and /dev/null differ diff --git a/sphaira/CMakeLists.txt b/sphaira/CMakeLists.txt index 362a196..64f12e4 100644 --- a/sphaira/CMakeLists.txt +++ b/sphaira/CMakeLists.txt @@ -62,7 +62,6 @@ add_executable(sphaira source/ui/sidebar.cpp source/ui/widget.cpp source/ui/list.cpp - source/ui/bubbles.cpp source/ui/scrolling_text.cpp source/app.cpp diff --git a/sphaira/include/ui/bubbles.hpp b/sphaira/include/ui/bubbles.hpp deleted file mode 100644 index 2114d44..0000000 --- a/sphaira/include/ui/bubbles.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "ui/types.hpp" -#include "ui/object.hpp" - -namespace sphaira::ui::bubble { - -void Init(); -void Draw(NVGcontext* vg, Theme* theme); -void Exit(); - -} // namespace sphaira::ui::bubble diff --git a/sphaira/source/app.cpp b/sphaira/source/app.cpp index 9e1beff..e72299d 100644 --- a/sphaira/source/app.cpp +++ b/sphaira/source/app.cpp @@ -1,5 +1,4 @@ #include "ui/option_box.hpp" -#include "ui/bubbles.hpp" #include "ui/sidebar.hpp" #include "ui/popup_list.hpp" #include "ui/option_box.hpp" @@ -1031,7 +1030,6 @@ void App::Draw() { } m_notif_manager.Draw(vg, &m_theme); - ui::bubble::Draw(vg, &m_theme); nvgResetTransform(vg); nvgEndFrame(this->vg); @@ -1419,34 +1417,6 @@ App::App(const char* argv0) { } } - struct EventDay { - u8 day; - u8 month; - }; - - static constexpr EventDay event_days[] = { - { .day = 1, .month = 1 }, // New years - - { .day = 3, .month = 3 }, // March 3 (switch 1) - { .day = 10, .month = 5 }, // June 10 (switch 2) - { .day = 15, .month = 5 }, // June 15 - - { .day = 25, .month = 12 }, // Christmas - { .day = 26, .month = 12 }, - { .day = 27, .month = 12 }, - { .day = 28, .month = 12 }, - }; - - const auto time = std::time(nullptr); - const auto tm = std::localtime(&time); - - for (auto e : event_days) { - if (e.day == tm->tm_mday && e.month == (tm->tm_mon + 1)) { - ui::bubble::Init(); - break; - } - } - App::Push(std::make_shared()); log_write("finished app constructor\n"); } @@ -1679,8 +1649,6 @@ App::~App() { i18n::exit(); curl::Exit(); - ui::bubble::Exit(); - // this has to be called before any cleanup to ensure the lifetime of // nvg is still active as some widgets may need to free images. m_widgets.clear(); diff --git a/sphaira/source/ui/bubbles.cpp b/sphaira/source/ui/bubbles.cpp deleted file mode 100644 index f7e580e..0000000 --- a/sphaira/source/ui/bubbles.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include "ui/types.hpp" -#include "ui/object.hpp" -#include "ui/nvg_util.hpp" -#include "app.hpp" - -namespace sphaira::ui::bubble { -namespace { - -constexpr auto MAX_BUBBLES = 20; - -struct Bubble { - int start_x; - int texture; - int x,y,w,h; - int y_inc; - float sway_inc; - float sway; - bool sway_right_flag; -}; - -Bubble bubbles[MAX_BUBBLES]{}; -int g_textures[3]; -bool g_is_init = false; - -void setup_bubble(Bubble *bubble) { - // setup normal vars. - bubble->texture = (randomGet64() % std::size(g_textures)); - bubble->start_x = randomGet64() % (int)SCREEN_WIDTH; - bubble->x = bubble->start_x; - bubble->y = (int)SCREEN_HEIGHT - ( randomGet64() % 60 ); - const int size = (randomGet64() % 50) + 40; - bubble->w = size; - bubble->h = size; - bubble->y_inc = (randomGet64() % 5) + 1; - bubble->sway_inc = ((randomGet64() % 6) + 3) / 10; - bubble->sway = 0; -} - -void setup_bubbles(void) { - for (auto& bubble : bubbles) { - setup_bubble(&bubble); - } -} - -void update_bubbles(void) { - for (auto& bubble : bubbles) { - if (bubble.y + bubble.h < 0) { - setup_bubble(&bubble); - } else { - bubble.y -= bubble.y_inc; - - if (bubble.sway_right_flag) { - bubble.x = bubble.start_x + (bubble.sway -= bubble.sway_inc); - if (bubble.sway <= 0) { - bubble.sway_right_flag = false; - } - } else { - bubble.x = bubble.start_x + (bubble.sway += bubble.sway_inc); - if (bubble.sway > 30) { - bubble.sway_right_flag = true; - } - } - } - } -} - -} // namespace - -void Init() { - if (g_is_init) { - return; - } - - if (R_SUCCEEDED(romfsInit())) { - ON_SCOPE_EXIT(romfsExit()); - - auto vg = App::GetVg(); - g_textures[0] = nvgCreateImage(vg, "romfs:/theme/bubble1.png", 0); - g_textures[1] = nvgCreateImage(vg, "romfs:/theme/bubble2.png", 0); - g_textures[2] = nvgCreateImage(vg, "romfs:/theme/bubble3.png", 0); - - setup_bubbles(); - g_is_init = true; - } -} - -void Draw(NVGcontext* vg, Theme* theme) { - if (!g_is_init) { - return; - } - - update_bubbles(); - - for (auto& bubble : bubbles) { - gfx::drawImage(vg, bubble.x, bubble.y, bubble.w, bubble.h, g_textures[bubble.texture]); - } -} - -void Exit() { - if (!g_is_init) { - return; - } - - auto vg = App::GetVg(); - for (auto& texture : g_textures) { - if (texture) { - nvgDeleteImage(vg, texture); - texture = 0; - } - } - - g_is_init = false; -} - -} // namespace sphaira::ui::bubble