diff --git a/Cargo.toml b/Cargo.toml index e6d0087..d661eaf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "egui_sdl2_platform" version = "0.4.0" edition = "2021" license = "MIT" -description = "A render-backend independant egui backend for sdl2" +description = "A render-backend independent egui backend for sdl2" [workspace] members = ["examples/*"] diff --git a/examples/sdl2_plus_glow/src/main.rs b/examples/sdl2_plus_glow/src/main.rs index 1608360..21856b9 100644 --- a/examples/sdl2_plus_glow/src/main.rs +++ b/examples/sdl2_plus_glow/src/main.rs @@ -41,7 +41,7 @@ async fn run() -> anyhow::Result<()> { let mut painter = egui_glow::Painter::new(Arc::new(gl), "", None, true).unwrap(); // Create the egui + sdl2 platform - let mut platform = egui_sdl2_platform::Platform::new(window.size())?; + let mut platform = egui_sdl2_platform::Platform::new(window.size()); // The clear color let mut color = [0.0, 0.0, 0.0, 1.0]; diff --git a/examples/sdl2_plus_wgpu/src/main.rs b/examples/sdl2_plus_wgpu/src/main.rs index e247901..6e92293 100644 --- a/examples/sdl2_plus_wgpu/src/main.rs +++ b/examples/sdl2_plus_wgpu/src/main.rs @@ -60,7 +60,7 @@ async fn run() -> anyhow::Result<()> { surface.configure(&device, &surface_config); // Create the egui + sdl2 platform - let mut platform = egui_sdl2_platform::Platform::new(window.size())?; + let mut platform = egui_sdl2_platform::Platform::new(window.size()); // Create the egui render pass let mut egui_pass = egui_wgpu_backend::RenderPass::new(&device, surface_format, 1); diff --git a/src/lib.rs b/src/lib.rs index 94abee2..9761a3b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -//! An graphics-backend independant egui backend for sdl2 +//! An graphics-backend independent egui backend for sdl2 pub mod conversions; pub mod platform; diff --git a/src/platform.rs b/src/platform.rs index 79bfcea..6f2e889 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -24,8 +24,8 @@ pub struct Platform { impl Platform { /// Construct a new [`Platform`] - pub fn new(screen_size: (u32, u32)) -> anyhow::Result { - Ok(Self { + pub fn new(screen_size: (u32, u32)) -> Self { + Self { cursor: Cursor::from_system(SystemCursor::Arrow) .map_err(|e| log::warn!("Failed to get cursor from systems cursor: {}", e)) .ok(), @@ -43,7 +43,7 @@ impl Platform { }, modifiers: Modifiers::default(), egui_ctx: egui::Context::default(), - }) + } } /// Handle a sdl2 event @@ -262,10 +262,9 @@ impl Platform { for cmd in &output.platform_output.commands { match cmd { egui::OutputCommand::CopyText(text) => { - video - .clipboard() - .set_clipboard_text(&text) - .map_err(|e| anyhow::anyhow!("Failed to assign text to clipboard: {}", e))?; + video.clipboard().set_clipboard_text(text).map_err(|e| { + anyhow::anyhow!("Failed to assign text to clipboard: {}", e) + })?; } egui::OutputCommand::CopyImage(_) | egui::OutputCommand::OpenUrl(_) => { // TODO: Handle CopyImage and OpenUrl commands