diff --git a/Makefile b/Makefile index 7ae6963..530046f 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DATA := data INCLUDES := include lib/zipper/include APP_TITLE := All-in-One Switch Updater APP_AUTHOR := HamletDuFromage -APP_VERSION := 2.0.0 +APP_VERSION := 2.0.1 TARGET := $(notdir $(CURDIR)) ROMFS := resources diff --git a/include/dialogue_page.hpp b/include/dialogue_page.hpp index a0bbf68..818eddb 100644 --- a/include/dialogue_page.hpp +++ b/include/dialogue_page.hpp @@ -12,6 +12,7 @@ class DialoguePage : public brls::View brls::Button* button1 = nullptr; brls::Button* button2 = nullptr; brls::Label* label = nullptr; + brls::NavigationMap navigationMap; public: DialoguePage(brls::StagedAppletFrame* frame, std::string text); @@ -19,5 +20,5 @@ class DialoguePage : public brls::View void draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) override; void layout(NVGcontext* vg, brls::Style* style, brls::FontStash* stash) override; brls::View* getDefaultFocus() override; - brls::View* getNextFocus(brls::FocusDirection direction, void* parentUserdata); + brls::View* getNextFocus(brls::FocusDirection direction, brls::View* currentView); }; \ No newline at end of file diff --git a/source/dialogue_page.cpp b/source/dialogue_page.cpp index 73914d5..690ea78 100644 --- a/source/dialogue_page.cpp +++ b/source/dialogue_page.cpp @@ -25,6 +25,16 @@ DialoguePage::DialoguePage(brls::StagedAppletFrame* frame, std::string text) this->label = new brls::Label(brls::LabelStyle::DIALOG, "menus/hekate_dialogue"_i18n + "\n\n" + text, true); this->label->setHorizontalAlign(NVG_ALIGN_CENTER); this->label->setParent(this); + + this->navigationMap.add( + this->button1, + brls::FocusDirection::RIGHT, + this->button2); + + this->navigationMap.add( + this->button2, + brls::FocusDirection::LEFT, + this->button1); } void DialoguePage::draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) @@ -63,12 +73,6 @@ brls::View* DialoguePage::getDefaultFocus() return this->button1; } -brls::View* DialoguePage::getNextFocus(brls::FocusDirection direction, void* parentUserdata){ - if(direction == brls::FocusDirection::LEFT){ - return this->button1; - } - if(direction == brls::FocusDirection::RIGHT){ - return this->button2; - } - return nullptr; +brls::View* DialoguePage::getNextFocus(brls::FocusDirection direction, brls::View* currentView){ + return this->navigationMap.getNextFocus(direction, currentView); }