40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
#include <cstdio>
|
|
#include <data.h>
|
|
#include <MainApplication.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 (data::user &u: data::users) {
|
|
auto username = pu::ui::elm::MenuItem::New(u.getUsername() + ": " + std::to_string(u.titleInfo.size()));
|
|
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());
|
|
data::setUserIndex(this->usersMenu->GetSelectedIndex());
|
|
mainApp->titlesLayout->InitTitles();
|
|
mainApp->LoadLayout(mainApp->titlesLayout);
|
|
}
|
|
}
|
|
}
|