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

Upgrade to egui v0.25.0 and miniquad v0.4 #65

Merged
merged 10 commits into from
Feb 21, 2024
Merged

Conversation

caspark
Copy link
Contributor

@caspark caspark commented Jan 31, 2024

This includes:

  • @not-fl3's (i.e. your) Update to miniquad-0.4 #63
    • It would be much easier to review this PR if that PR were merged first. I don't think anything much I've done here depends on that PR (so feel free to rebase and drop this commit), but I wanted all this to work against the latest miniquad version, so I included your PR because of that. Also, that PR has been open for 6 months now, so I figured why not include it :)
  • @emilk's Update to egui 0.23 #64
    • (well, not the exact commit from that PR: I copied over the 2 lines of changes from it, bumped to latest miniquad 4.x alpha, and fixed the 2 broken examples in this crate)
  • and 2 more commits to update to egui 0.24.1 and 0.25.0.

I've tested a little bit and "things seem to work" - at least the obvious stuff like rendering, mouse and keyboard input handling, etc.

Things I'm not sure about:

  • The flickering between the color-test gradients that @emilk noted in Update to egui 0.23 #64 is still there. It only appears between two gradients.. is that a big deal? Not for me, but it might be for others.
  • High DPI screens support. Egui 0.24.0 revamped how pixels per point is calculated and used. I made a best effort attempt to integrate this correctly but I couldn't find any big picture docs and I don't use a high DPI screen so I'm not sure it's done correctly.
    • And it looks like egui can suggest DPI changes back to the egui backend now as well, based on the user zooming in or something like that? I didn't implement this side of things at all because I don't need it.
    • Update: this should now be implemented properly thanks to some helpful pointers from @emilk .

So.. it's not a rock solid PR, but I'm raising it anyway to save others doing the same work if they don't care about these limitations.

Copy link
Sponsor Collaborator

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks good, except for the pixels-per-point thing

src/lib.rs Outdated
textures_delta,
shapes,
pixels_per_point, //TODO not handling change in pixels per point (check zooming in/out behavior in egui)
Copy link
Sponsor Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is egui telling you what its (current) definition of a "point" is. It is the value that should be passed to tessellate

src/lib.rs Outdated
if let Some(shapes) = self.shapes.take() {
let meshes = self.egui_ctx.tessellate(shapes);
let meshes = self.egui_ctx.tessellate(shapes, self.native_dpi_scale);
Copy link
Sponsor Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we should use the pixels_per_point reported by egui, because that can differ from native_dpi_scale if the user has bit Ctrl+/-

@not-fl3
Copy link
Owner

not-fl3 commented Jan 31, 2024

Give me about a week, I am about to publish miniquad-0.4 without alpha.

(yes, I was about to publish it since forever, but now I really am!)

Bit hard to zoom in and out when equals and minus keys aren't being
passed to egui!
@caspark
Copy link
Contributor Author

caspark commented Feb 1, 2024

  • Thanks for the pointers @emilk - got the points per pixel stuff fixed now. (I suspected it was meant to be that simple, but when I tried it nothing happened, which was because of the next bullet)
  • @not-fl3 I've also added support for punctuation keys that were missing, most notably plus and equals!
  • I've also replaced the manual override of pixels per point in the demo example with manually setting zoom factor instead; otherwise changing zoom factor in egui with its built in keyboard bindings will immediately be reset to 1.0 zoom next frame.

With all 3 of those things fixed, you can now zoom the demo example in and out (and reset zoom) as expected with Ctrl/Command +/-/0.

So this PR is now B+ quality, with the only remaining thing being the gap between the gradients (which, again, I can live with).

examples/demo.rs Outdated Show resolved Hide resolved
@emilk
Copy link
Sponsor Collaborator

emilk commented Feb 1, 2024

Btw, a new egui is coming next week too :)

@not-fl3
Copy link
Owner

not-fl3 commented Feb 21, 2024

Give me about a week, I am about to publish miniquad-0.4 without alpha.

(yes, I was about to publish it since forever, but now I really am!)

commented 3 weeks ago

anyway, miniquad is released, no more github/crates differences nor -alpha versions!
Most changes are internal for metal backend, so this PR should(mostly) just work.

I could have sworn that I had already fixed it properly previously, but
zooming via the slider wasn't working. But now it is. Let's hope I'm not
hallucinating this time.
@caspark
Copy link
Contributor Author

caspark commented Feb 21, 2024

Yay!

I've updated this PR to target miniquad 0.4.0 now, so: time to hit merge?

(I know there's egui 0.26 out already, but maybe let's just get this merged first)

@emilk emilk merged commit 822b2d1 into not-fl3:master Feb 21, 2024
4 checks passed
@HughHoyland HughHoyland mentioned this pull request Mar 11, 2024
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.

None yet

3 participants