I can't help but wonder how much game devs would benefit from a UI framework. Laying out UI elements in code just seems so 90's. While his transformations surely improved the code--and actually start making it resemble a typical UI framework--markup languages take it to a whole new level of compressed clarity. Like XAML:
Here's a video from the same author about immediate-mode GUIs, which are a conscious effort to avoid that sort of UI design.
In your case you may have simplified the code that creates the UI, but you aren't showing the code that maps the string "do_auto_snap" to the function that performs the action.
In your case you may have simplified the code that creates the UI, but you aren't showing the code that maps the string "do_auto_snap" to the function that performs the action.
Because the framework does that for you at compile time.
What we really need is a way to interleave retained mode UI surfaces with immediate mode rendering surfaces. There are various frameworks that support that but I suspect none are a good fit for cross platform game development.
I wonder if this guy advocating purely immediate-mode GUIs has ever worked on a substantial UI before (i.e., not one that looks like it was made by an engineer, and that is more complicated than a game UI). You quickly benefit from design tools.
I am not a great person to argue about retained vs immediate mode UIs, but as an anecdote: I just made a UI in Qt which is effectively a property sheet: editing a bunch of properties of different types. So for every property, I had to create the retained mode controls programmatically and hook them up. Qt did some very nice stuff for me automatically (minimal layout hassles, yay!), but then I spent a bunch of time mirroring values stored in different places. The underlaying data could change, at which point I had to change the controls' value, or a control could change and I had to mirror the value to the underlying value. And when there are two controls for the same value (text field and slider for instance), I need to avoid making my changes to one control trigger a signal and notify me again for the other control when I push the change to it. And to enable/disable these controls, I need to keep them all in a list so I can go find them and turn off their 'enabled' state. All of those problems go away in a proper immediate-mode implementation, where there isn't a separate piece of state I have to spend a lot of code to maintain.
4
u/WhyComplicateThingz May 28 '14
I can't help but wonder how much game devs would benefit from a UI framework. Laying out UI elements in code just seems so 90's. While his transformations surely improved the code--and actually start making it resemble a typical UI framework--markup languages take it to a whole new level of compressed clarity. Like XAML:
This allows styling and layout to be nicely decoupled from hit-testing and behaviors.