mirror of
https://github.com/XorTroll/uLaunch
synced 2024-11-10 06:24:12 +00:00
Add screenshots and names over folders
This commit is contained in:
parent
6016f7ace5
commit
ade837bd78
12 changed files with 65 additions and 11 deletions
|
@ -15,7 +15,7 @@ namespace ui
|
|||
static constexpr u32 ExtraIconSize = ItemSize + (Margin * 2);
|
||||
|
||||
public:
|
||||
SideMenu(pu::ui::Color SuspendedColor, std::string CursorPath, std::string SuspendedImagePath, std::string MultiselectImagePath, s32 y);
|
||||
SideMenu(pu::ui::Color SuspendedColor, std::string CursorPath, std::string SuspendedImagePath, std::string MultiselectImagePath, u32 TextX, u32 TextY, u32 TextSize, pu::ui::Color TextColor, s32 y);
|
||||
PU_SMART_CTOR(SideMenu)
|
||||
~SideMenu();
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace ui
|
|||
void SetOnItemSelected(std::function<void(u64, u32)> Fn);
|
||||
void SetOnSelectionChanged(std::function<void(u32)> Fn);
|
||||
void ClearItems();
|
||||
void AddItem(std::string Icon);
|
||||
void AddItem(std::string Icon, std::string Text = "");
|
||||
void SetSuspendedItem(u32 Index);
|
||||
void UnsetSuspendedItem();
|
||||
void SetSelectedItem(u32 Index);
|
||||
|
@ -54,17 +54,23 @@ namespace ui
|
|||
int suspitm;
|
||||
u32 baseiconidx;
|
||||
u8 movalpha;
|
||||
u32 textx;
|
||||
u32 texty;
|
||||
pu::ui::Color suspclr;
|
||||
pu::ui::Color textclr;
|
||||
std::vector<std::string> icons;
|
||||
std::vector<std::string> icons_texts;
|
||||
std::vector<bool> icons_mselected;
|
||||
std::function<void(u64, u32)> onselect;
|
||||
std::function<void(u32)> onselch;
|
||||
std::vector<pu::ui::render::NativeTexture> ricons;
|
||||
std::vector<pu::ui::render::NativeTexture> ricons_texts;
|
||||
pu::ui::render::NativeTexture cursoricon;
|
||||
pu::ui::render::NativeTexture suspicon;
|
||||
pu::ui::render::NativeTexture leftbicon;
|
||||
pu::ui::render::NativeTexture rightbicon;
|
||||
pu::ui::render::NativeTexture mselicon;
|
||||
pu::ui::render::NativeFont textfont;
|
||||
std::chrono::steady_clock::time_point scrolltp;
|
||||
bool scrollmoveflag;
|
||||
std::chrono::steady_clock::time_point scrollmovetp;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
{
|
||||
"suspended_final_alpha": 80,
|
||||
"menu_focus_color": "#5ebcffff",
|
||||
"menu_bg_color": "#0094ffff"
|
||||
"menu_bg_color": "#0094ffff",
|
||||
"menu_folder_text_x": 30,
|
||||
"menu_folder_text_y": 200,
|
||||
"menu_folder_text_size": 25
|
||||
}
|
|
@ -32,6 +32,9 @@ namespace ui
|
|||
this->select_on = false;
|
||||
|
||||
pu::ui::Color textclr = pu::ui::Color::FromHex(qapp->GetUIConfigValue<std::string>("text_color", "#e1e1e1ff"));
|
||||
u32 menutextx = qapp->GetUIConfigValue<u32>("menu_folder_text_x", 15);
|
||||
u32 menutexty = qapp->GetUIConfigValue<u32>("menu_folder_text_y", 15);
|
||||
u32 menutextsz = qapp->GetUIConfigValue<u32>("menu_folder_text_size", 25);
|
||||
|
||||
this->bgSuspendedRaw = RawData::New(0, 0, raw, 1280, 720, 4);
|
||||
this->Add(this->bgSuspendedRaw);
|
||||
|
@ -112,7 +115,7 @@ namespace ui
|
|||
qapp->ApplyConfigForElement("main_menu", "banner_version_text", this->itemVersion);
|
||||
this->Add(this->itemVersion);
|
||||
|
||||
this->itemsMenu = SideMenu::New(pu::ui::Color(0, 255, 120, 255), cfg::ProcessedThemeResource(theme, "ui/Cursor.png"), cfg::ProcessedThemeResource(theme, "ui/Suspended.png"), cfg::ProcessedThemeResource(theme, "ui/Multiselect.png"), 294);
|
||||
this->itemsMenu = SideMenu::New(pu::ui::Color(0, 255, 120, 255), cfg::ProcessedThemeResource(theme, "ui/Cursor.png"), cfg::ProcessedThemeResource(theme, "ui/Suspended.png"), cfg::ProcessedThemeResource(theme, "ui/Multiselect.png"), menutextx, menutexty, menutextsz, textclr, 294);
|
||||
this->MoveFolder("", false);
|
||||
this->itemsMenu->SetOnItemSelected(std::bind(&MenuLayout::menu_Click, this, std::placeholders::_1, std::placeholders::_2));
|
||||
this->itemsMenu->SetOnSelectionChanged(std::bind(&MenuLayout::menu_OnSelected, this, std::placeholders::_1));
|
||||
|
@ -542,7 +545,7 @@ namespace ui
|
|||
if(name.empty())
|
||||
{
|
||||
STL_REMOVE_IF(list.folders, fldr, (fldr.titles.empty())) // Remove empty folders
|
||||
for(auto folder: list.folders) this->itemsMenu->AddItem(cfg::ProcessedThemeResource(theme, "ui/Folder.png"));
|
||||
for(auto folder: list.folders) this->itemsMenu->AddItem(cfg::ProcessedThemeResource(theme, "ui/Folder.png"), folder.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace ui
|
||||
{
|
||||
SideMenu::SideMenu(pu::ui::Color SuspendedColor, std::string CursorPath, std::string SuspendedImagePath, std::string MultiselectImagePath, s32 y)
|
||||
SideMenu::SideMenu(pu::ui::Color SuspendedColor, std::string CursorPath, std::string SuspendedImagePath, std::string MultiselectImagePath, u32 TextX, u32 TextY, u32 TextSize, pu::ui::Color TextColor, s32 y)
|
||||
{
|
||||
this->selitm = 0;
|
||||
this->suspitm = -1;
|
||||
|
@ -15,6 +15,10 @@ namespace ui
|
|||
this->cursoricon = pu::ui::render::LoadImage(CursorPath);
|
||||
this->suspicon = pu::ui::render::LoadImage(SuspendedImagePath);
|
||||
this->mselicon = pu::ui::render::LoadImage(MultiselectImagePath);
|
||||
this->textfont = pu::ui::render::LoadDefaultFont(TextSize);
|
||||
this->textx = TextX;
|
||||
this->texty = TextY;
|
||||
this->textclr = TextColor;
|
||||
this->onselect = [&](u32,u64){};
|
||||
this->onselch = [&](u32){};
|
||||
this->scrolltpvalue = 50;
|
||||
|
@ -34,6 +38,7 @@ namespace ui
|
|||
pu::ui::render::DeleteTexture(this->suspicon);
|
||||
this->suspicon = NULL;
|
||||
}
|
||||
pu::ui::render::DeleteFont(this->textfont);
|
||||
this->ClearItems();
|
||||
}
|
||||
|
||||
|
@ -73,7 +78,11 @@ namespace ui
|
|||
for(u32 i = 0; i < std::min((size_t)4, (this->icons.size() - this->baseiconidx)); i++)
|
||||
{
|
||||
auto icon = pu::ui::render::LoadImage(this->icons[this->baseiconidx + i]);
|
||||
auto text = this->icons_texts[this->baseiconidx + i];
|
||||
this->ricons.push_back(icon);
|
||||
pu::ui::render::NativeTexture ntext = NULL;
|
||||
if(!text.empty()) ntext = pu::ui::render::RenderText(this->textfont, text, this->textclr);
|
||||
this->ricons_texts.push_back(ntext);
|
||||
}
|
||||
this->UpdateBorderIcons();
|
||||
(this->onselch)(this->selitm);
|
||||
|
@ -85,6 +94,8 @@ namespace ui
|
|||
{
|
||||
auto ricon = this->ricons[i];
|
||||
Drawer->RenderTexture(ricon, basex, Y, { -1, ItemSize, ItemSize, -1 });
|
||||
auto ntext = this->ricons_texts[i];
|
||||
if(ntext != NULL) Drawer->RenderTexture(ntext, basex + this->textx, Y + this->texty);
|
||||
if(this->IsItemMultiselected(this->baseiconidx + i)) Drawer->RenderTexture(this->mselicon, basex - Margin, Y - Margin, { -1, ExtraIconSize, ExtraIconSize, -1 });
|
||||
if(this->suspitm >= 0)
|
||||
{
|
||||
|
@ -245,21 +256,28 @@ namespace ui
|
|||
void SideMenu::ClearItems()
|
||||
{
|
||||
this->icons.clear();
|
||||
this->icons_texts.clear();
|
||||
this->icons_mselected.clear();
|
||||
for(auto ricon: this->ricons)
|
||||
{
|
||||
if(ricon != NULL) pu::ui::render::DeleteTexture(ricon);
|
||||
}
|
||||
this->ricons.clear();
|
||||
for(auto rtext: this->ricons_texts)
|
||||
{
|
||||
if(rtext != NULL) pu::ui::render::DeleteTexture(rtext);
|
||||
}
|
||||
this->ricons_texts.clear();
|
||||
this->selitm = 0;
|
||||
this->baseiconidx = 0;
|
||||
this->suspitm = -1;
|
||||
this->ClearBorderIcons();
|
||||
}
|
||||
|
||||
void SideMenu::AddItem(std::string Icon)
|
||||
void SideMenu::AddItem(std::string Icon, std::string Text)
|
||||
{
|
||||
this->icons.push_back(Icon);
|
||||
this->icons_texts.push_back(Text);
|
||||
this->icons_mselected.push_back(false);
|
||||
}
|
||||
|
||||
|
@ -343,25 +361,37 @@ namespace ui
|
|||
{
|
||||
case 1: // Left
|
||||
{
|
||||
auto icon = pu::ui::render::LoadImage(icons[selitm]);
|
||||
auto icon = pu::ui::render::LoadImage(this->icons[this->selitm]);
|
||||
this->ricons.insert(this->ricons.begin(), icon);
|
||||
baseiconidx--;
|
||||
auto text = this->icons_texts[this->selitm];
|
||||
pu::ui::render::NativeTexture ntext = NULL;
|
||||
if(!text.empty()) ntext = pu::ui::render::RenderText(this->textfont, text, this->textclr);
|
||||
this->ricons_texts.insert(this->ricons_texts.begin(), ntext);
|
||||
this->baseiconidx--;
|
||||
if(this->ricons.size() == 5)
|
||||
{
|
||||
pu::ui::render::DeleteTexture(this->ricons.back());
|
||||
this->ricons.pop_back();
|
||||
auto ntext = this->ricons_texts.back();
|
||||
if(ntext != NULL) pu::ui::render::DeleteTexture(ntext);
|
||||
this->ricons_texts.pop_back();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // Right
|
||||
{
|
||||
auto icon = pu::ui::render::LoadImage(icons[selitm]);
|
||||
auto icon = pu::ui::render::LoadImage(this->icons[this->selitm]);
|
||||
this->ricons.push_back(icon);
|
||||
auto ntext = pu::ui::render::RenderText(this->textfont, this->icons_texts[this->selitm], this->textclr);
|
||||
this->ricons_texts.push_back(ntext);
|
||||
if(this->ricons.size() == 5)
|
||||
{
|
||||
pu::ui::render::DeleteTexture(this->ricons.front());
|
||||
this->ricons.erase(this->ricons.begin());
|
||||
baseiconidx++;
|
||||
auto ntext = this->ricons_texts.front();
|
||||
if(ntext != NULL) pu::ui::render::DeleteTexture(ntext);
|
||||
this->ricons_texts.erase(this->ricons_texts.begin());
|
||||
this->baseiconidx++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
|
||||
> Custom, open-source replacement/reimplementation for Nintendo Switch's HOME Menu (qlaunch), extending it with amazing, homebrew-orienteed functionality!
|
||||
|
||||
<img src="Screenshots/s1.png" alt="drawing" width="400"/> <img src="Screenshots/s2.png" alt="drawing" width="400"/>
|
||||
|
||||
<img src="Screenshots/s2.png" alt="drawing" width="400"/> <img src="Screenshots/s4.png" alt="drawing" width="400"/>
|
||||
|
||||
<img src="Screenshots/s5.png" alt="drawing" width="400"/> <img src="Screenshots/s6.png" alt="drawing" width="400"/>
|
||||
|
||||
uLaunch is a very ambicious project, consisting on two custom library applets, a custom system application and a custom system applet, in order to replace the console's **HOME menu** with a custom, homebrew-orienteed one.
|
||||
|
||||
No, this isn't any kind of HOME menu extension, injection, patch, etc. uLaunch is a **complete** reimplementation, 100% open-source, which also takes over eShop and Mii applets and flog system title, for its extended functionality.
|
||||
|
|
BIN
Screenshots/s1.png
Normal file
BIN
Screenshots/s1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 411 KiB |
BIN
Screenshots/s2.png
Normal file
BIN
Screenshots/s2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 155 KiB |
BIN
Screenshots/s3.png
Normal file
BIN
Screenshots/s3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 590 KiB |
BIN
Screenshots/s4.png
Normal file
BIN
Screenshots/s4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 282 KiB |
BIN
Screenshots/s5.png
Normal file
BIN
Screenshots/s5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 314 KiB |
BIN
Screenshots/s6.png
Normal file
BIN
Screenshots/s6.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 288 KiB |
|
@ -97,6 +97,10 @@ Can be customized via files in `/ui`.
|
|||
"menu_focus_color": "#5ebcffff",
|
||||
"menu_bg_color": "#0094ffff",
|
||||
|
||||
"menu_folder_text_x": 15,
|
||||
"menu_folder_text_y": 15,
|
||||
"menu_folder_text_size": 25,
|
||||
|
||||
"main_menu": {
|
||||
"connection_icon": {
|
||||
"x": 10,
|
||||
|
@ -121,6 +125,8 @@ Can be customized via files in `/ui`.
|
|||
|
||||
- **menu_bg_color**: All menus' bg color.
|
||||
|
||||
- **menu_folder_text_x**, **menu_folder_text_y**, **menu_folder_text_size**: X, Y and text size for the small text shown over folder icons in the main menu.
|
||||
|
||||
Element customization: consists on menus and items within them, with customizable `visible`, `x` and `y` properties. If `visible` is false, custom X and Y will be ignored.
|
||||
|
||||
- Main menu (`main_menu`): items are `top_menu_bg`, `logo_icon`, `connection_icon`, `user_icon`, `web_icon`, `time_text`, `battery_text`, `battery_icon`, `settings_icon`, `themes_icon`, `firmware_text`, `menu_toggle_button`, `banner_image`, `banner_name_text`, `banner_author_text`, `banner_version_text` and `items_menu`.
|
||||
|
|
Loading…
Reference in a new issue