-
Notifications
You must be signed in to change notification settings - Fork 370
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
Update to latest egui + use new Image api #3311
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Juts some cleanup
@@ -10,6 +12,10 @@ impl Icon { | |||
pub const fn new(id: &'static str, png_bytes: &'static [u8]) -> Self { | |||
Self { id, png_bytes } | |||
} | |||
|
|||
pub fn as_image(&self) -> Image<'static> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be an impl From<&Icon> for Image<'static>
if let Ok(TexturePoll::Ready { texture }) = icon_image.load(ui) { | ||
icon_image.paint_at(ui, self.icon_rect, &texture); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do this pattern a lot now. We should make sure something like this works instead:
if let Ok(TexturePoll::Ready { texture }) = icon_image.load(ui) { | |
icon_image.paint_at(ui, self.icon_rect, &texture); | |
} | |
icon_image.paint_at(ui, self.icon_rect); |
I feel like everytime we as users see a naked TexturePoll
, that's a failure in the egui interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(we can save this for later)
What
egui
to point to latest commit on Final polish for new image loading emilk/egui#3328StaticImageCache
, as its a part ofegui
nowegui::Image
Checklist