3 ms·
I'm sorry, but I've got to call this out as woefully inaccurate. > [...] so you can handle the event loop in a sane way. The whole point of an immediate-mode
by jesse__ 3y ago
I'm sorry, but I've got to call this out as woefully inaccurate.
> [...] so you can handle the event loop in a sane way.
The whole point of an immediate-mode framework is that the call-stack acts as the event loop. You run through your UI code, and if a thing was interacted with on the previous frame, you just handle it. What about that setup is not sane?
> [...] instead of just smashing everything into one form [...]
There is nothing about immediate mode that makes it more or less able to have everything 'smashed into one form'. You can do that just as well with your retained-mode framework of choice.
> The trouble comes from not componentizing things
This also has nothing to do with the immediate vs. retained mode discussion. You could just as easily make a giant mess in retained-mode by not making reusable components.
> once you start dealing with multiple application views that conditionally show/hide, with branching flows of any kind [..]
In my spare time, I work on a game engine whose editor/debug UI is completely immediate mode. There are discrete views into nearly everything in the engine. Entity data, a color picker, memory and CPU performance views, asset viewers/pickers, a terrain editor with like 10 modes.. you name it. There are plenty of conditionally shown views. There is plenty of 'componentizing' of things going on. The editor UI is in the neighborhood of 10k lines, most of which is generated. If that's below your bar for quick-n-dirty, maybe we have different opinions on what qualifies.
- moron4hire 3y ago>> The editor UI is in the neighborhood of 10k lines, most of which is generated. I mean, this sounds like you've created a retained mode DSL that gets compiled into immediate mode. And yes, 10 KLoC is definitely a small project, especially when "most of which is generated".
- jesse__ 3y ago> this sounds like you've created a retained mode DSL that gets compiled into immediate mode Nope, I wrote a template-metaprogramming language, which generates the UI. There's nothing retained-mode about it. The source code: https://github.com/scallyw4g/bonsai/blob/672a3520d7537ef4e754e0dc2535f2df5817c99a/src/engine/editor.h#L81 https://github.com/scallyw4g/bonsai/blob/672a3520d7537ef4e75... The result: https://github.com/scallyw4g/bonsai/blob/master/generated/do_editor_ui_for_compound_type_world_chunk.h https://github.com/scallyw4g/bonsai/blob/master/generated/do... > And yes, 10 KLoC is definitely a small project I said it cleared the bar for quick-n-dirty. I agree it's not a large amount of code.
- HelloNurse 3y ago> You could just as easily make a giant mess in retained-mode by not making reusable components. Classic example: the Swing library for Java has layout managers, which help panels decide where their children go, and the most "powerful" one is the GridBagLayout, roughly equivalent to HTML tables with extra features and a favorite of GUI builders. It can be used to make an unmaintainable monster layout of most of a complex window in a single panel, to structure a trivial reusable component that would be easier to write with a simpler layout manager, or to try and design intermediate level components that are self-contained and benefit from general layout configuration, with no guidance at all from the library or from tools.