From 7085cc79acc99c929f151cdec975a3b9223cb101 Mon Sep 17 00:00:00 2001 From: mrdude2478 Date: Wed, 27 Apr 2022 19:21:40 +0100 Subject: [PATCH] fix exit button main menu --- include/Plutonium/Example/source/MainApplication.cpp | 2 +- include/ui/mainPage.hpp | 2 +- source/ui/mainPage.cpp | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/Plutonium/Example/source/MainApplication.cpp b/include/Plutonium/Example/source/MainApplication.cpp index cecb547..c657ddd 100644 --- a/include/Plutonium/Example/source/MainApplication.cpp +++ b/include/Plutonium/Example/source/MainApplication.cpp @@ -23,7 +23,7 @@ void MainApplication::OnLoad() { // You can use member functions via std::bind() C++ wrapper this->SetOnInput([&](const u64 keys_down, const u64 keys_up, const u64 keys_held, const pu::ui::TouchPoint touch_pos) { // If X is pressed, start with our dialog questions! - if(keys_down & HidNpadButton_X) { + if(keys_held & HidNpadButton_X) { int opt = this->CreateShowDialog("Question", "Do you like apples?", { "Yes!", "No...", "Cancel" }, true); // (using latest option as cancel option) // -1 and -2 are similar, but if the user cancels manually -1 is set, other types or cancel should be -2. if((opt == -1) || (opt == -2)) { diff --git a/include/ui/mainPage.hpp b/include/ui/mainPage.hpp index 809f372..27ca387 100644 --- a/include/ui/mainPage.hpp +++ b/include/ui/mainPage.hpp @@ -14,7 +14,7 @@ namespace inst::ui { void HdInstallMenuItem_Click(); void settingsMenuItem_Click(); void exitMenuItem_Click(); - void onInput(u64 Down, u64 Up, u64 Held, pu::ui::TouchPoint touch_pos); + void onInput(u64 Down, u64 Up, const u64 Held, pu::ui::TouchPoint touch_pos); Image::Ref awooImage; private: diff --git a/source/ui/mainPage.cpp b/source/ui/mainPage.cpp index ec5f015..e64201a 100644 --- a/source/ui/mainPage.cpp +++ b/source/ui/mainPage.cpp @@ -257,9 +257,9 @@ namespace inst::ui { mainApp->LoadLayout(mainApp->optionspage); } - void MainPage::onInput(u64 Down, u64 Up, u64 Held, pu::ui::TouchPoint touch_pos) { //some issue with held - fix later....27/4/22 + void MainPage::onInput(u64 Down, u64 Up, u64 Held, pu::ui::TouchPoint touch_pos) { - if (((Down & HidNpadButton_Plus) || (Down & HidNpadButton_Minus) || ((Down & HidNpadButton_L) && ( Down & HidNpadButton_R))) && mainApp->IsShown()) { + if (((Down & HidNpadButton_Plus) || (Down & HidNpadButton_Minus) || ((Held & HidNpadButton_L) && ( Down & HidNpadButton_R)) || ((Down & HidNpadButton_L) && ( Held & HidNpadButton_R))) && mainApp->IsShown()) { mainApp->FadeOut(); mainApp->Close(); } @@ -301,7 +301,6 @@ namespace inst::ui { if (Down & HidNpadButton_Y) { mathstuff(); - } - + } } } \ No newline at end of file