News for hackers. Stuff that matters.
Re:Immediate Mode GUI Programming by alpaca128 on Monday January 15, 2024 @06:55PM (#39007676)
Immediate mode means instead of changing the state of UI widgets individually, the entire UI is redrawn with the current state. Afaik this has slightly worse performance but can simplify the code because the UI itself doesn't hold any state.
Re:Immediate Mode GUI Programming by flohofwoe on Tuesday January 16, 2024 @05:02AM (#39011508)
> because the UI itself doesn't hold any state.

...which isn't actually true in most immediate mode UI frameworks. They absolutely do persist state between frames. That state is just on the other side of the API invisible from the API user.

'Immediate mode UI' is only an API design philosophy, it says nothing about what happens under the hood.

Re:Immediate Mode GUI Programming by danpla on Tuesday January 16, 2024 @12:56PM (#39016376)
> 'Immediate mode UI' is only an API design philosophy, it says nothing about what happens under the hood.

Well, if you have a traditional immediate mode API like:

    if (button("Start"))
        start();
Then it's not just about the API philosophy: at the very least, it ties the event handling to the drawing.
Re:Immediate Mode GUI Programming by flohofwoe on Tuesday January 16, 2024 @05:59PM (#39020373)
Which kinda makes sense, because a non-existing button usually isn't clickable, and also wouldn't be able to emit events in an event-driven API ;)

Btw, the drawing doesn't happen in the button function, it just tells the UI system that there exists a button with the label "Start" in the current frame. The rendering usually happens much later after the UI system has collected the entire UI description for the frame, otherwise rendering would be very inefficient.