diff options
author | 2022-01-31 17:01:19 +0700 | |
---|---|---|
committer | 2022-01-31 17:01:19 +0700 | |
commit | e4ef29ef20724c3d1a4beff39ddfdaf6d45f9683 (patch) | |
tree | 6e0c9c38366c9d70204c80fc66bd8e8a7652cf52 /src/application.rs | |
parent | c75ed37148b019358b0297171cf31b2577eeb9ae (diff) | |
parent | 6f604ab3995cb345aacf183a569589988aa3ad1f (diff) | |
download | iced-e4ef29ef20724c3d1a4beff39ddfdaf6d45f9683.tar.gz iced-e4ef29ef20724c3d1a4beff39ddfdaf6d45f9683.tar.bz2 iced-e4ef29ef20724c3d1a4beff39ddfdaf6d45f9683.zip |
Merge pull request #1096 from pacmancoder/feat/wgpu-webgl
Experimental WebGL wgpu backend support
Diffstat (limited to 'src/application.rs')
-rw-r--r-- | src/application.rs | 78 |
1 files changed, 17 insertions, 61 deletions
diff --git a/src/application.rs b/src/application.rs index b722c8a3..14a16d61 100644 --- a/src/application.rs +++ b/src/application.rs @@ -198,39 +198,28 @@ pub trait Application: Sized { where Self: 'static, { - #[cfg(not(target_arch = "wasm32"))] - { - let renderer_settings = crate::renderer::Settings { - default_font: settings.default_font, - default_text_size: settings.default_text_size, - text_multithreading: settings.text_multithreading, - antialiasing: if settings.antialiasing { - Some(crate::renderer::settings::Antialiasing::MSAAx4) - } else { - None - }, - ..crate::renderer::Settings::from_env() - }; - - Ok(crate::runtime::application::run::< - Instance<Self>, - Self::Executor, - crate::renderer::window::Compositor, - >(settings.into(), renderer_settings)?) - } - - #[cfg(target_arch = "wasm32")] - { - <Instance<Self> as iced_web::Application>::run(settings.flags); - - Ok(()) - } + let renderer_settings = crate::renderer::Settings { + default_font: settings.default_font, + default_text_size: settings.default_text_size, + text_multithreading: settings.text_multithreading, + antialiasing: if settings.antialiasing { + Some(crate::renderer::settings::Antialiasing::MSAAx4) + } else { + None + }, + ..crate::renderer::Settings::from_env() + }; + + Ok(crate::runtime::application::run::< + Instance<Self>, + Self::Executor, + crate::renderer::window::Compositor, + >(settings.into(), renderer_settings)?) } } struct Instance<A: Application>(A); -#[cfg(not(target_arch = "wasm32"))] impl<A> iced_winit::Program for Instance<A> where A: Application, @@ -247,7 +236,6 @@ where } } -#[cfg(not(target_arch = "wasm32"))] impl<A> crate::runtime::Application for Instance<A> where A: Application, @@ -288,35 +276,3 @@ where self.0.should_exit() } } - -#[cfg(target_arch = "wasm32")] -impl<A> iced_web::Application for Instance<A> -where - A: Application, -{ - type Executor = A::Executor; - type Message = A::Message; - type Flags = A::Flags; - - fn new(flags: Self::Flags) -> (Self, Command<A::Message>) { - let (app, command) = A::new(flags); - - (Instance(app), command) - } - - fn title(&self) -> String { - self.0.title() - } - - fn update(&mut self, message: Self::Message) -> Command<Self::Message> { - self.0.update(message) - } - - fn subscription(&self) -> Subscription<Self::Message> { - self.0.subscription() - } - - fn view(&mut self) -> Element<'_, Self::Message> { - self.0.view() - } -} |