Fixed cursor obstruction issues and hiding main menu popup issues

This commit is contained in:
Yousef Khadadeh 2026-03-31 18:41:19 +03:00
parent 16c3097534
commit ed36036aea
21 changed files with 124 additions and 141 deletions

View file

@ -6,13 +6,19 @@ namespace GUIStuff { namespace ElementHelpers {
void text_button(GUIManager& gui, const char* id, std::string_view text, const TextButtonOptions& options) {
SelectableButton::Data d = selectable_button_options_to_data(options);
d.innerContent = [&gui, text] (const SelectableButton::InnerContentCallbackParameters&) {
text_label(gui, text);
d.innerContent = [&gui, text, centered = options.centered] (const SelectableButton::InnerContentCallbackParameters&) {
CLAY_AUTO_ID({
.layout = {
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0) },
.childAlignment = {.x = centered ? CLAY_ALIGN_X_CENTER : CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER}
}
}) {
text_label(gui, text);
}
};
CLAY_AUTO_ID({
.layout = {
.sizing = {.width = options.wide ? CLAY_SIZING_GROW(0) : CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0) },
.childAlignment = {.x = options.centered ? CLAY_ALIGN_X_CENTER : CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER}
.sizing = {.width = options.wide ? CLAY_SIZING_GROW(0) : CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0) }
}
}) {
gui.element<SelectableButton>(id, d);