remove bubbles, no one likes easter eggs apparently.

fixes #138
This commit is contained in:
ITotalJustice
2025-05-11 02:41:56 +01:00
parent e279a70606
commit 20e2d85843
7 changed files with 0 additions and 158 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

View File

@@ -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

View File

@@ -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

View File

@@ -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<ui::menu::main::MainMenu>());
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();

View File

@@ -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