From b4b84d0cc53c139d15c8b64e8521b13da40ed990 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 16 Jul 2021 21:07:00 -0500 Subject: [PATCH] fix(main): Allow emu to work on windows and linux --- src/main.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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)?) }