Implemented prompt component and utilize for gfx change confirmation

This commit is contained in:
thecozies
2024-04-20 13:25:46 -05:00
parent bf167f31c7
commit 12f52eab2f
7 changed files with 194 additions and 19 deletions
+18
View File
@@ -985,6 +985,21 @@ struct UIContext {
tab->SetProperty("nav-down", "#" + id);
}
}
void update_prompt_loop(void) {
recomp::PromptContext *ctx = recomp::get_prompt_context();
if (!ctx->shouldFocus) return;
Rml::Element* focused = current_document->GetFocusLeafNode();
if (focused) focused->Blur();
Rml::Element *targetButton = current_document->GetElementById(
ctx->focusOnCancel ? "prompt__cancel-button" : "prompt__confirm-button");
targetButton->Focus(true);
ctx->shouldFocus = false;
}
} rml;
};
@@ -1148,6 +1163,9 @@ void draw_hook(RT64::RenderCommandList* command_list, RT64::RenderFramebuffer* s
if (cur_menu == recomp::Menu::Config) {
ui_context->rml.update_config_menu_loop(menu_changed);
}
if (cur_menu != recomp::Menu::None) {
ui_context->rml.update_prompt_loop();
}
while (recomp::try_deque_event(cur_event)) {
bool menu_is_open = cur_menu != recomp::Menu::None;