Starting work on moving GUI to event system (doesnt compile)

This commit is contained in:
Yousef Khadadeh 2026-03-27 09:51:53 +03:00
parent f1a855edc3
commit ef7dfcef05
69 changed files with 4296 additions and 3709 deletions

View file

@ -4,7 +4,10 @@
namespace GUIStuff {
void TextParagraph::update(UpdateInputData& io, std::unique_ptr<skia::textlayout::Paragraph> paragraph, float width, const std::function<void()>& elemUpdate) {
TextParagraph::TextParagraph(GUIManager& gui):
Element(gui) {}
void TextParagraph::layout(std::unique_ptr<skia::textlayout::Paragraph> paragraph, float width) {
data = std::move(paragraph);
data->layout(width);
CLAY_AUTO_ID({
@ -12,17 +15,14 @@ void TextParagraph::update(UpdateInputData& io, std::unique_ptr<skia::textlayout
.sizing = {.width = CLAY_SIZING_FIXED(width), .height = CLAY_SIZING_FIXED(data->getHeight())}
},
.custom = { .customData = this }
}) {
if(elemUpdate)
elemUpdate();
}
}) {}
}
void TextParagraph::clay_draw(SkCanvas* canvas, UpdateInputData& io, Clay_RenderCommand* command, bool skiaAA) {
bb = get_bb(command);
if(data)
if(data) {
auto& bb = boundingBox.value();
data->paint(canvas, bb.min.x(), bb.min.y());
}
}
}