3 ms·
For more context, immediate mode is much closer to the type of declarative UI popularized by libraries like React. The invariant is that what is displayed on s
by btown 9y ago
For more context, immediate mode is much closer to the type of declarative UI popularized by libraries like React. The invariant is that what is displayed on screen is always a pure function of some state variable(s), and on any input/event, instead of needing to "reach into" some retained object that represents a certain piece of text in a certain pane in a certain window, you just change those state variables and re-render the entire UI from scratch. Sounds expensive, but for a 2D UI on hardware that's designed to do far more complicated things at 60FPS, it's far from the bottleneck.
For instance, https://github.com/billsix/pyNuklear/blob/master/demo/overview.py#L305 https://github.com/billsix/pyNuklear/blob/master/demo/overvi... (this function is called repeatedly on each frame) is not significantly different from the example at https://reactjs.org/tutorial/tutorial.html#what-is-react https://reactjs.org/tutorial/tutorial.html#what-is-react ... but it is very different from something like `div = createDiv(); div2 = createDiv(parent=div)` etc. which would be a retained-mode API.
- billsix 9y agohttps://youtu.be/Z1qyvQsjK5Y https://youtu.be/Z1qyvQsjK5Y