Replace iced_web with WebGL support in wgpu 🎉
This commit is contained in:
parent
1e3feee3a3
commit
825c7749ff
35 changed files with 68 additions and 3474 deletions
|
|
@ -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()
|
||||
};
|
||||
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(())
|
||||
}
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue