Implement iced_glutin 🎉
This commit is contained in:
parent
a1a5fcfd46
commit
e0e4ee73fe
31 changed files with 718 additions and 498 deletions
|
|
@ -188,19 +188,19 @@ pub trait Application: Sized {
|
|||
{
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
let wgpu_settings = iced_wgpu::Settings {
|
||||
let glow_settings = iced_glow::Settings {
|
||||
default_font: settings.default_font,
|
||||
antialiasing: if settings.antialiasing {
|
||||
Some(iced_wgpu::settings::Antialiasing::MSAAx4)
|
||||
Some(iced_glow::settings::Antialiasing::MSAAx4)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
..iced_wgpu::Settings::default()
|
||||
..iced_glow::Settings::default()
|
||||
};
|
||||
|
||||
<Instance<Self> as iced_winit::Application>::run(
|
||||
<Instance<Self> as iced_glutin::Application>::run(
|
||||
settings.into(),
|
||||
wgpu_settings,
|
||||
glow_settings,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -212,11 +212,11 @@ pub trait Application: Sized {
|
|||
struct Instance<A: Application>(A);
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
impl<A> iced_winit::Application for Instance<A>
|
||||
impl<A> iced_glutin::Application for Instance<A>
|
||||
where
|
||||
A: Application,
|
||||
{
|
||||
type Compositor = iced_wgpu::window::Compositor;
|
||||
type Compositor = iced_glow::window::Compositor;
|
||||
type Executor = A::Executor;
|
||||
type Flags = A::Flags;
|
||||
type Message = A::Message;
|
||||
|
|
@ -231,10 +231,10 @@ where
|
|||
self.0.title()
|
||||
}
|
||||
|
||||
fn mode(&self) -> iced_winit::Mode {
|
||||
fn mode(&self) -> iced_glutin::Mode {
|
||||
match self.0.mode() {
|
||||
window::Mode::Windowed => iced_winit::Mode::Windowed,
|
||||
window::Mode::Fullscreen => iced_winit::Mode::Fullscreen,
|
||||
window::Mode::Windowed => iced_glutin::Mode::Windowed,
|
||||
window::Mode::Fullscreen => iced_glutin::Mode::Fullscreen,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
/// This is an alias of an `iced_native` element with a default `Renderer`.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub type Element<'a, Message> =
|
||||
iced_winit::Element<'a, Message, iced_wgpu::Renderer>;
|
||||
iced_glutin::Element<'a, Message, iced_glow::Renderer>;
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub use iced_web::Element;
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ pub use sandbox::Sandbox;
|
|||
pub use settings::Settings;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use iced_winit as runtime;
|
||||
use iced_glutin as runtime;
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use iced_web as runtime;
|
||||
|
|
|
|||
|
|
@ -51,10 +51,10 @@ impl<Flags> Settings<Flags> {
|
|||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
impl<Flags> From<Settings<Flags>> for iced_winit::Settings<Flags> {
|
||||
fn from(settings: Settings<Flags>) -> iced_winit::Settings<Flags> {
|
||||
iced_winit::Settings {
|
||||
window: iced_winit::settings::Window {
|
||||
impl<Flags> From<Settings<Flags>> for iced_glutin::Settings<Flags> {
|
||||
fn from(settings: Settings<Flags>) -> iced_glutin::Settings<Flags> {
|
||||
iced_glutin::Settings {
|
||||
window: iced_glutin::settings::Window {
|
||||
size: settings.window.size,
|
||||
resizable: settings.window.resizable,
|
||||
decorations: settings.window.decorations,
|
||||
|
|
|
|||
|
|
@ -18,29 +18,27 @@
|
|||
//! [`text_input::State`]: text_input/struct.State.html
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
mod platform {
|
||||
pub use iced_wgpu::widget::{
|
||||
pub use iced_glow::widget::{
|
||||
button, checkbox, container, pane_grid, progress_bar, radio,
|
||||
scrollable, slider, text_input, Text,
|
||||
scrollable, slider, text_input, Column, Row, Space, Text,
|
||||
};
|
||||
|
||||
#[cfg(feature = "canvas")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "canvas")))]
|
||||
pub use iced_wgpu::widget::canvas;
|
||||
pub use iced_glow::widget::canvas;
|
||||
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "image")))]
|
||||
pub mod image {
|
||||
//! Display images in your user interface.
|
||||
pub use iced_winit::image::{Handle, Image};
|
||||
pub use iced_glutin::image::{Handle, Image};
|
||||
}
|
||||
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "svg")))]
|
||||
pub mod svg {
|
||||
//! Display vector graphics in your user interface.
|
||||
pub use iced_winit::svg::{Handle, Svg};
|
||||
pub use iced_glutin::svg::{Handle, Svg};
|
||||
}
|
||||
|
||||
pub use iced_winit::Space;
|
||||
|
||||
#[doc(no_inline)]
|
||||
pub use {
|
||||
button::Button, checkbox::Checkbox, container::Container, image::Image,
|
||||
|
|
@ -52,18 +50,6 @@ mod platform {
|
|||
#[cfg(feature = "canvas")]
|
||||
#[doc(no_inline)]
|
||||
pub use canvas::Canvas;
|
||||
|
||||
/// A container that distributes its contents vertically.
|
||||
///
|
||||
/// This is an alias of an `iced_native` column with a default `Renderer`.
|
||||
pub type Column<'a, Message> =
|
||||
iced_winit::Column<'a, Message, iced_wgpu::Renderer>;
|
||||
|
||||
/// A container that distributes its contents horizontally.
|
||||
///
|
||||
/// This is an alias of an `iced_native` row with a default `Renderer`.
|
||||
pub type Row<'a, Message> =
|
||||
iced_winit::Row<'a, Message, iced_wgpu::Renderer>;
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue