Skip to content

Update to egui 0.31 #79

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

Merged
merged 1 commit into from
May 19, 2025
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
97 changes: 41 additions & 56 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"]

[dependencies]
bytemuck = "1.9"
egui = { version = "0.28", features = ["bytemuck"] }
miniquad = { version = "=0.4.0" }
egui = { version = "0.31.1", features = ["bytemuck"] }
miniquad = { version = "0.4.8" }
quad-url = "0.1"

[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand All @@ -31,7 +31,7 @@ quad-rand = "0.2.1"
copypasta = "0.10.0"

[dev-dependencies]
egui_demo_lib = { version = "0.28", default-features = false }
egui_demo_lib = { version = "0.31.1", default-features = false }
glam = "0.28.0"

[profile.release]
Expand Down
2 changes: 1 addition & 1 deletion examples/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl mq::EventHandler for Stage {
self.prev_egui_zoom_factor = curr_egui_zoom;

egui::Window::new("egui ❤ miniquad").show(egui_ctx, |ui| {
egui::widgets::global_dark_light_mode_buttons(ui);
egui::widgets::global_theme_preference_buttons(ui);
ui.checkbox(&mut self.show_egui_demo_windows, "Show egui demo windows");

ui.group(|ui| {
Expand Down
22 changes: 12 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl EguiMq {
pub fn run(
&mut self,
mq_ctx: &mut dyn mq::RenderingBackend,
run_ui: impl FnOnce(&mut dyn mq::RenderingBackend, &egui::Context),
mut run_ui: impl FnMut(&mut dyn mq::RenderingBackend, &egui::Context),
) {
input::on_frame_start(&mut self.egui_input, &self.egui_ctx);

Expand Down Expand Up @@ -202,32 +202,34 @@ impl EguiMq {
self.textures_delta.append(textures_delta);

let egui::PlatformOutput {
commands,
cursor_icon,
open_url,
copied_text,
events: _, // no screen reader
ime: _, // no IME
mutable_text_under_cursor: _, // no IME
..
} = platform_output;

if let Some(url) = open_url {
quad_url::link_open(&url.url, url.new_tab);
for command in commands {
match command {
egui::OutputCommand::OpenUrl(open_url) => {
quad_url::link_open(&open_url.url, open_url.new_tab);
}
egui::OutputCommand::CopyText(copied_text) => {
self.set_clipboard(copied_text);
}
egui::OutputCommand::CopyImage(_) => (), // No implementation for miniquad
}
}

if cursor_icon == egui::CursorIcon::None {
miniquad::window::show_mouse(false);
} else {
miniquad::window::show_mouse(true);

let mq_cursor_icon = to_mq_cursor_icon(cursor_icon);
let mq_cursor_icon = mq_cursor_icon.unwrap_or(mq::CursorIcon::Default);
miniquad::window::set_mouse_cursor(mq_cursor_icon);
}

if !copied_text.is_empty() {
self.set_clipboard(copied_text);
}
}

/// Call this when you need to draw egui.
Expand Down
Loading