Files
NXST/source/UsersLayout.cpp

39 lines
1.3 KiB
C++

#include <cstdio>
#include <MainApplication.hpp>
#include "main.hpp"
namespace ui {
extern MainApplication *mainApp;
UsersLayout::UsersLayout() : Layout::Layout() {
this->usersMenu = pu::ui::elm::Menu::New(0, 0, 1280, COLOR("#67000000"), COLOR("#170909FF"), 94, 7);
this->usersMenu->SetScrollbarColor(COLOR("#170909FF"));
for (AccountUid const& uid : Account::ids()) {
auto username = pu::ui::elm::MenuItem::New(Account::username(uid) + ": " + std::to_string(getTitleCount(uid)));
username->SetColor(COLOR("#FFFFFFFF"));
this->usersMenu->AddItem(username);
}
this->SetBackgroundColor(BACKGROUND_COLOR);
this->Add(this->usersMenu);
}
int32_t UsersLayout::GetCurrentIndex() {
return this->usersMenu->GetSelectedIndex();
}
void UsersLayout::onInput(u64 Down, u64 Up, u64 Held, pu::ui::TouchPoint Pos) {
if (Down & HidNpadButton_Plus) {
mainApp->Close();
return;
}
if (Down & HidNpadButton_A) {
printf("current index is %i\n", this->usersMenu->GetSelectedIndex());
g_currentUId = Account::ids().at(this->usersMenu->GetSelectedIndex());
mainApp->titlesLayout->InitTitles();
mainApp->LoadLayout(mainApp->titlesLayout);
}
}
}