Skip to content
Open
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*"]
Expand Down
2 changes: 1 addition & 1 deletion examples/sdl2_plus_glow/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion examples/sdl2_plus_wgpu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
13 changes: 6 additions & 7 deletions src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ pub struct Platform {

impl Platform {
/// Construct a new [`Platform`]
pub fn new(screen_size: (u32, u32)) -> anyhow::Result<Self> {
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(),
Expand All @@ -43,7 +43,7 @@ impl Platform {
},
modifiers: Modifiers::default(),
egui_ctx: egui::Context::default(),
})
}
}

/// Handle a sdl2 event
Expand Down Expand Up @@ -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
Expand Down