-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flex layout implementation #153
Comments
Unfortunately, Dear ImGui (the original library) is not built with layouts in mind. There are PR's like ocornut/imgui#846, but as you can see from the date of its create (2016) and the fact that it's still not merged - widgets layout is not a main course of the library. It's possible to implement stuff like that by yourself, but it's always a work from the ground. A hard work I might say. Also, as the workaround solution you can try to use table API. It's pretty useful in situations when you need to spread items properly. Still, it's far away from functionality like flexbox though... For the reference: |
Thanks @SpaiR , that's sad to hear though. FlexLayout ly = new FlexLayout(null); // parent == null thus sets the window as its parent
// Default alignment of FlexLayout is vertical
ly.horizontal() // returns a new child FlexLayout with horizontal alignment
.text("Some ").text("text!");
ly.vertical() // returns a new child FlexLayout with vertical alignment
.text("More ").text("text!"); If someone is interested in using/contributing, the source code for this is here: Currently I am having troubles setting custom widths, specially heights for the components, no clue how to achieve that in imgui, since |
@Osiris-Team You may find it interesting: https://www.reddit.com/r/java/comments/xarfpq/jvm_port_of_randrews_layout_a_simplefast_stacking/ |
Wow that looks exactly like what I was looking for! Thanks! |
So in the end the library is not meant to be used with imgui it seems. The main reason that I gave up imgui is, because its weird and harder to write async code that interacts with the UI. Besides that I have a full Java FlexBox "implementation", check out this class: https://github.com/Osiris-Team/Desku/blob/main/src/main/java/com/osiris/desku/ui/Component.java The memory usage and the cpu usage are very low (around 17MB for an almost blank window + dev tools window, note that I substracted the reserved null heap from Java wich is around 160MB). |
Is there an implementation of css flexbox for this?
I find it quite annoying to give absolute coordinates and sizes to almost all my components.
https://www.w3.org/TR/css-flexbox-1/#box-model
Also it looks like I can't position text?
The text was updated successfully, but these errors were encountered: