3 ms·
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 pe
by alpaca128 3y ago
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.
- flohofwoe 3y ago> 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.
- danpla 3y ago> '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.
- flohofwoe 3y agoWhich 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.