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

Update egui to 1.16.1 #49

Merged
merged 2 commits into from
Jan 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ open_url = ["webbrowser"]
[dependencies]
bevy = { version = "0.5", default-features = false, features = [
"render",
"bevy_winit"
"bevy_winit",
] }
egui = "0.15.0"
egui = "0.16.1"
webbrowser = { version = "0.5.5", optional = true }
winit = { version = "0.24.0", features = ["x11"], default-features = false }

Expand All @@ -38,5 +38,5 @@ version-sync = "0.9.2"
bevy = { version = "0.5", default-features = false, features = [
"bevy_wgpu",
"x11",
"png"
"png",
] }
9 changes: 5 additions & 4 deletions examples/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,17 @@ fn ui_example(
));

ui.with_layout(egui::Layout::bottom_up(egui::Align::Center), |ui| {
ui.add(
egui::Hyperlink::new("https://github.com/emilk/egui/").text("powered by egui"),
);
ui.add(egui::Hyperlink::from_label_and_url(
"powered by egui",
"https://github.com/emilk/egui/",
));
});
});

egui::TopBottomPanel::top("top_panel").show(egui_ctx.ctx(), |ui| {
// The top panel is often a good place for a menu bar:
egui::menu::bar(ui, |ui| {
egui::menu::menu(ui, "File", |ui| {
egui::menu::menu_button(ui, "File", |ui| {
if ui.button("Quit").clicked() {
std::process::exit(0);
}
Expand Down
8 changes: 4 additions & 4 deletions src/egui_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use bevy::{
utils::HashMap,
window::WindowId,
};
use egui::paint::ClippedShape;
use egui::epaint::ClippedShape;
use std::{borrow::Cow, collections::HashSet};

pub struct EguiNode {
Expand Down Expand Up @@ -523,7 +523,7 @@ impl EguiNode {
self.update_texture(render_resource_context, texture, texture_handle);
}

let egui_texture = egui_context.ctx_for_window(self.window_id).texture();
let egui_texture = egui_context.ctx_for_window(self.window_id).font_image();
if self.egui_texture_version != Some(egui_texture.version) {
self.egui_texture_version = Some(egui_texture.version);
if let Some(egui_texture_handle) = self.egui_texture.clone() {
Expand Down Expand Up @@ -561,7 +561,7 @@ impl EguiNode {
texture_assets: &mut Assets<Texture>,
) {
if self.egui_texture.is_none() {
let texture = egui_context.ctx_for_window(self.window_id).texture();
let texture = egui_context.ctx_for_window(self.window_id).font_image();
self.egui_texture = Some(texture_assets.add(as_bevy_texture(&texture)));
self.egui_texture_version = Some(texture.version);

Expand Down Expand Up @@ -769,7 +769,7 @@ fn find_bind_group_by_binding_name(
.cloned()
}

fn as_bevy_texture(egui_texture: &egui::Texture) -> Texture {
fn as_bevy_texture(egui_texture: &egui::FontImage) -> Texture {
let mut pixels = Vec::new();
pixels.reserve(4 * pixels.len());
for &alpha in egui_texture.pixels.iter() {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ pub struct EguiShapes {
/// Pairs of rectangles and paint commands.
///
/// The field gets populated during the [`EguiStage::UiFrameEnd`] stage and reset during `EguiNode::update`.
pub shapes: Vec<egui::paint::ClippedShape>,
pub shapes: Vec<egui::epaint::ClippedShape>,
}

/// Is used for storing Egui output. The actual resource is [`HashMap<WindowId, EguiOutput>`].
Expand Down
2 changes: 1 addition & 1 deletion src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub fn process_input(
}

for egui_input in input_resources.egui_input.values_mut() {
egui_input.raw_input.scroll_delta += delta;
egui_input.raw_input.events.push(egui::Event::Scroll(delta));
}
}

Expand Down