3 ms·
Naive question from someone who hasn't touched GUI programming since visual studio/QT GUI designer circa 2005 : Isn't a more declarative approached like XAML/Q
by soulbadguy 3y ago
Naive question from someone who hasn't touched GUI programming since visual studio/QT GUI designer circa 2005 :
Isn't a more declarative approached like XAML/QML (or even html/ccs) a better way to represent a GUI interface as opposed to an imperative list of command embedded inside the business logic of the application ?
How does IMGUI handle theming, reflow or even GPU acceleration on different platform ? It seems to me that a more declarive representation would allow for better tooling and easier split between presentation and themes to match the native platform.
- flohofwoe 3y agoDear ImGui code actually looks quite declarative, except that the actions are directly 'inlined' into the UI declaration as code. For instance: if (ImGui::Button("Click Me")) { // do the stuff that should happen when the button is clicked } To hide a part of the UI you simply skip the code which describes that part of the UI. if (!btnHidden) { if (ImGui::Button("Click Me")) { ... } } Your code describes what the UI should look like in the current frame, and what should happen on user interactions, but without event listeners or callback functions. How you keep the UI declaration separate from the "business logic" is up to you. Dear ImGui allows very close coupling (which quite often is actually an advantage for adhoc UIs), or you can keep both separated as much as you prefer. > How does IMGUI handle theming, reflow or even GPU acceleration on different platform ? Dear ImGui actually builds an internal "stateful" representation of the UI declaration (it needs to remember at least some state between frames, otherwise simple features like moveable/sizeable windows wouldn't be possible) and then generates an optimized list of rendering commands that plug almost directly into 3D rendering APIs like D3D, Metal, GL etc... (the renderer is implemented outside of Dear ImGui by yourself, however Dear ImGui also comes with pluggable example renderers and window system glue for pretty much any platform and 3D API). Themeing/skinning is indeed a weak point of Dear ImGui specifically, other immediate mode UI frameworks like Nuklear offer more flexibility there, but this has nothing to do with the imgui philosophy, only with feature sets of specific imgui libraries.
- msk-lywenn 3y agoAre you asking about the IMGUI paradigm or DearIMGUI the library? In the case of DearIMGUI: - it does not handle theming (but forks do) - I don't know what reflow is - in a way, GPU acceleration is the default. In fact, DearIMGUI doesn't handle anything at all in that regards because it doesn't have to. You are the one responsible for drawing, DearIMGUI just outputs you a vertex buffer that you send to the GPU the way you want to. There are proposed backends but you can totally roll your own. People even have made networked and web backends. I don't know how those work.
- WhereIsTheTruth 3y agoImGui is engine/GPU agnostic Themeing isn't a just a retained mode thing, you can do wonders with immediate UIs, even though (dear)ImGui doesn't provide much, you can still do wonders: https://github.com/ocornut/imgui/issues/707#issuecomment-362574409 https://github.com/ocornut/imgui/issues/707#issuecomment-362... The gaming cheating community is quite creative as well: https://www.unknowncheats.me/forum/c-and-c-/505940-advanced-imgui-cheat-menu.html https://www.unknowncheats.me/forum/c-and-c-/505940-advanced-... More on that topic: https://www.youtube.com/watch?v=Z1qyvQsjK5Y https://www.youtube.com/watch?v=Z1qyvQsjK5Y