More GUI code moved to events, code now compiles but application doesn't run

This commit is contained in:
Yousef Khadadeh 2026-03-30 17:05:24 +03:00
parent 3566b7e563
commit b4c35124c3
37 changed files with 913 additions and 879 deletions

View file

@ -47,9 +47,10 @@ void text_button_sized(GUIManager& gui, const char* id, std::string_view text, C
void svg_icon_button(GUIManager& gui, const char* id, const std::string& svgPath, const SVGButtonOptions& options = {});
template <typename T> void color_button(GUIManager& gui, const char* id, T* val, const FixedSizeColorButtonOptions& options = {}) {
gui.push_id(id);
SelectableButton::Data d = selectable_button_options_to_data(options);
d.innerContent = [&] (const SelectableButton::InnerContentCallbackParameters&) {
gui.element<ColorRectangleDisplay>([val, hasAlpha = options.hasAlpha] {
gui.element<ColorRectangleDisplay>("color display", [val, hasAlpha = options.hasAlpha] {
if(hasAlpha)
return SkColor4f{(*val)[0], (*val)[1], (*val)[2], 1.0f};
else
@ -57,8 +58,9 @@ template <typename T> void color_button(GUIManager& gui, const char* id, T* val,
});
};
CLAY_AUTO_ID({.layout = {.sizing = {.width = CLAY_SIZING_FIXED(options.size), .height = CLAY_SIZING_FIXED(options.size) } } }) {
gui.element<SelectableButton>(id, options);
gui.element<SelectableButton>("button", d);
}
gui.pop_id();
}
}}