Skip to content
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

Add Dear ImGui example #116

Merged
merged 7 commits into from
Sep 18, 2020
Merged

Add Dear ImGui example #116

merged 7 commits into from
Sep 18, 2020

Conversation

parasyte
Copy link
Owner

@parasyte parasyte commented Sep 8, 2020

I'm not super happy with this, but it's good enough for now.

imgui is notoriously bad about color space management. See ocornut/imgui#578 This PR uses the same hack that I added to the imgui-gfx support crate a few years ago.

The other issue is that I originally wanted to draw the windows and GUI elements in the prepare method. This turned out to be impossible because of the lifetime requirement on imgui::Ui. The compromise I came up with was moving all drawing to the render method so the Ui type doesn't have to cross exclusive borrow boundaries, resolving all lifetime issues.

@parasyte parasyte mentioned this pull request Sep 8, 2020
- The local bool is necessary because the menu bar closures are not allowed to borrow `self` for mutable access while `imgui::Ui<'ui>` is alive.
- The token-based menu bar lifetime is even more verbose than this.
@parasyte parasyte merged commit 11dca72 into master Sep 18, 2020
@parasyte parasyte deleted the imgui-winit branch September 18, 2020 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI with pixels
1 participant