diff --git a/aiosu-rcm b/aiosu-rcm index bd424fc..53df22c 160000 --- a/aiosu-rcm +++ b/aiosu-rcm @@ -1 +1 @@ -Subproject commit bd424fccefa768df315ae1819268d2e8864a80c2 +Subproject commit 53df22c99d1fcf17ec5dce93ea787f7d84f190b6 diff --git a/include/dialogue_page.hpp b/include/dialogue_page.hpp index 348d13b..6f4d9fa 100644 --- a/include/dialogue_page.hpp +++ b/include/dialogue_page.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include class DialoguePage : public brls::View { @@ -8,6 +9,7 @@ class DialoguePage : public brls::View brls::Button* button1 = nullptr; brls::Button* button2 = nullptr; brls::Label* label = nullptr; + std::chrono::system_clock::time_point start = std::chrono::high_resolution_clock::now(); brls::NavigationMap navigationMap; bool erista = true; diff --git a/source/dialogue_page.cpp b/source/dialogue_page.cpp index 8712c32..61995f4 100644 --- a/source/dialogue_page.cpp +++ b/source/dialogue_page.cpp @@ -3,6 +3,7 @@ #include "main_frame.hpp" #include "fs.hpp" #include +#include namespace i18n = brls::i18n; using namespace i18n::literals; @@ -59,6 +60,18 @@ void DialoguePage::draw(NVGcontext* vg, int x, int y, unsigned width, unsigned h { this->label->frame(ctx); this->button1->frame(ctx); + + auto end = std::chrono::high_resolution_clock::now(); + auto missing = std::max(1l - std::chrono::duration_cast(end - start).count(), 0l); + auto text = std::string("menus/common/no"_i18n); + if (missing > 0) { + this->button2->setLabel(text + " (" + std::to_string(missing) + ")"); + this->button2->setState(brls::ButtonState::DISABLED); + } else { + this->button2->setLabel(text); + this->button2->setState(brls::ButtonState::ENABLED); + } + this->button2->invalidate(); this->button2->frame(ctx); } @@ -84,6 +97,8 @@ void DialoguePage::layout(NVGcontext* vg, brls::Style* style, brls::FontStash* s style->CrashFrame.buttonWidth, style->CrashFrame.buttonHeight); this->button2->invalidate(); + + start = std::chrono::high_resolution_clock::now() + std::chrono::milliseconds(150); } brls::View* DialoguePage::getDefaultFocus()