diff --git a/src/main.rs b/src/main.rs index 1a0b9b5..830eb17 100644 --- a/src/main.rs +++ b/src/main.rs @@ -140,6 +140,7 @@ fn main() -> Result<()> { }); } +#[cfg(not(windows))] fn create_window(event_loop: &EventLoop<()>, title: &str) -> Result { let size = LogicalSize::new((GB_WIDTH as f64) * SCALE, (GB_HEIGHT as f64) * SCALE); Ok(WindowBuilder::new() @@ -149,6 +150,21 @@ fn create_window(event_loop: &EventLoop<()>, title: &str) -> Result { .with_resizable(true) .with_decorations(true) .with_transparent(false) - // .with_drag_and_drop(false) // OleInitialize failed error if this is set to true + .build(event_loop)?) +} + +#[cfg(windows)] +fn create_window(event_loop: &EventLoop<()>, title: &str) -> Result { + use winit::platform::windows::WindowBuilderExtWindows; + + let size = LogicalSize::new((GB_WIDTH as f64) * SCALE, (GB_HEIGHT as f64) * SCALE); + Ok(WindowBuilder::new() + .with_title(title) + .with_inner_size(size) + .with_min_inner_size(size) + .with_resizable(true) + .with_decorations(true) + .with_transparent(false) + .with_drag_and_drop(false) .build(event_loop)?) }