-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Replace eframe::Frame
commands and WindowInfo
with egui
#3564
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emilk
changed the title
Small improvements for multi-viewports
Replace Nov 18, 2023
eframe::Frame
commands and WindowInfo
with egui
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In short
You now almost never need to use
eframe::Frame
- instead useui.input(|i| i.viewport())
for information about the current viewport (native window), and usectx.send_viewport_cmd
to modify it.In detail
This PR removes most commands from
eframe::Frame
, and replaces them withViewportCommand
.So
frame.close()
becomesctx.send_viewport_cmd(ViewportCommand::Close)
, etc.frame.info().window_info
is now also gone, replaced withui.input(|i| i.viewport())
.frame.info().native_pixels_per_point
is replaced withui.input(|i| i.raw.native_pixels_per_point)
.RawInput
now contains oneViewportInfo
for each viewport.Screenshots are taken with
ctx.send_viewport_cmd(ViewportCommand::Screenshots)
and are returned inegui::Event
which you can check with:Motivation
You no longer need to pass around the
&eframe::Frame
everywhere.This also opens the door for other integrations to use the same API of
ViewportCommand
s.