From dcd9ddde50e82dff90cc2170a6fe694060b3db57 Mon Sep 17 00:00:00 2001 From: Ryan Goldstein Date: Tue, 24 Sep 2019 19:44:43 -0400 Subject: [PATCH] Fix the examples --- examples/custom_events.rs | 28 +++++++++++++++++----------- examples/multithreaded.rs | 8 -------- examples/window_run_return.rs | 16 +--------------- 3 files changed, 18 insertions(+), 34 deletions(-) diff --git a/examples/custom_events.rs b/examples/custom_events.rs index c85d4ecd..dba43624 100644 --- a/examples/custom_events.rs +++ b/examples/custom_events.rs @@ -1,15 +1,16 @@ -use winit::{ - event::{Event, WindowEvent}, - event_loop::{ControlFlow, EventLoop}, - window::WindowBuilder, -}; - -#[derive(Debug, Clone, Copy)] -enum CustomEvent { - Timer, -} - +#[cfg(not(target_arch = "wasm32"))] fn main() { + use winit::{ + event::{Event, WindowEvent}, + event_loop::{ControlFlow, EventLoop}, + window::WindowBuilder, + }; + + #[derive(Debug, Clone, Copy)] + enum CustomEvent { + Timer, + } + let event_loop = EventLoop::::with_user_event(); let _window = WindowBuilder::new() @@ -39,3 +40,8 @@ fn main() { _ => *control_flow = ControlFlow::Wait, }); } + +#[cfg(target_arch = "wasm32")] +fn main() { + panic!("This example is not supported on web."); +} diff --git a/examples/multithreaded.rs b/examples/multithreaded.rs index 65afeae8..aa03b627 100644 --- a/examples/multithreaded.rs +++ b/examples/multithreaded.rs @@ -2,15 +2,7 @@ fn main() { extern crate env_logger; -<<<<<<< HEAD use std::{collections::HashMap, sync::mpsc, thread, time::Duration}; -======= -use winit::{ - event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent}, - event_loop::{ControlFlow, EventLoop}, - window::{CursorIcon, Fullscreen, WindowBuilder}, -}; ->>>>>>> master use winit::{ event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent}, diff --git a/examples/window_run_return.rs b/examples/window_run_return.rs index 82c49d61..29ea7b3c 100644 --- a/examples/window_run_return.rs +++ b/examples/window_run_return.rs @@ -1,6 +1,3 @@ -<<<<<<< HEAD -#[cfg(not(target_arch = "wasm32"))] -======= // Limit this example to only compatible platforms. #[cfg(any( target_os = "windows", @@ -11,7 +8,6 @@ target_os = "netbsd", target_os = "openbsd" ))] ->>>>>>> master fn main() { use winit::{ event::{Event, WindowEvent}, @@ -19,10 +15,6 @@ fn main() { platform::desktop::EventLoopExtDesktop, window::WindowBuilder, }; -<<<<<<< HEAD -======= - ->>>>>>> master let mut event_loop = EventLoop::new(); let window = WindowBuilder::new() @@ -57,13 +49,7 @@ fn main() { println!("Okay we're done now for real."); } -<<<<<<< HEAD -#[cfg(target_arch = "wasm32")] -fn main() { - panic!("Example not supported on Wasm"); -======= -#[cfg(any(target_os = "ios", target_os = "android"))] +#[cfg(any(target_os = "ios", target_os = "android", target_arch = "wasm32"))] fn main() { println!("This platform doesn't support run_return."); ->>>>>>> master }