Skip to content

API discrepancy #7

Open
Open
@Uriopass

Description

@Uriopass

With imgui-rs, the API is pretty much the same for everything.
WidgetType::new().param(args).build(&ui, || closure executed if widget is open for example for windows or buttons)
(Actually, that's not entirely true, small widgets use ifs but their API is moving toward this version by version)

However while looking through egui's source code, I've seen 4 ways the API is declared.
menu does everything in the constructor:
menu::menu(ui, "Windows", |ui| { ... })

Button uses ifs and ui.add:
if ui.add(Button::new("Clear memory")).clicked { ... }

Windows looks a bit like imgui:
Window::new("Examples").show(ctx, |ui| { ... })

collapsing comes directly from the ui object:
ui.collapsing("About Egui", |ui| { ... })

4 different ways of doing control flow for the same idea, which makes it a bit awkward to use.

PS: I'm doing a lot of issues but it's because I'm seriously considering the crate for my project and there's a few quirks before I'm thinking of moving to it. I absolutely admire the amount of work you've put into it !

Metadata

Metadata

Assignees

No one assigned

    Labels

    designSome architectual design work needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions