2019-11-25 14:17:13 +01:00
|
|
|
//! Configure your application.
|
2020-01-16 05:54:22 +01:00
|
|
|
use crate::window;
|
2019-11-25 14:17:13 +01:00
|
|
|
|
|
|
|
|
/// The settings of an application.
|
2020-01-09 18:31:07 +01:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
2019-11-25 14:17:13 +01:00
|
|
|
pub struct Settings {
|
2020-01-16 05:54:22 +01:00
|
|
|
/// The window settings.
|
2019-11-25 14:17:13 +01:00
|
|
|
///
|
|
|
|
|
/// They will be ignored on the Web.
|
|
|
|
|
///
|
|
|
|
|
/// [`Window`]: struct.Window.html
|
2020-01-16 05:54:22 +01:00
|
|
|
pub window: window::Settings,
|
2019-12-29 12:29:47 +01:00
|
|
|
|
2020-01-09 18:31:07 +01:00
|
|
|
/// The bytes of the font that will be used by default.
|
|
|
|
|
///
|
|
|
|
|
/// If `None` is provided, a default system font will be chosen.
|
2020-01-01 17:49:48 +01:00
|
|
|
// TODO: Add `name` for web compatibility
|
|
|
|
|
pub default_font: Option<&'static [u8]>,
|
2020-02-15 10:08:27 +01:00
|
|
|
|
2020-02-18 09:54:24 +01:00
|
|
|
/// If set to true, the renderer will try to perform antialiasing for some
|
2020-02-15 10:08:27 +01:00
|
|
|
/// primitives.
|
|
|
|
|
///
|
|
|
|
|
/// Enabling it can produce a smoother result in some widgets, like the
|
|
|
|
|
/// `Canvas`, at a performance cost.
|
|
|
|
|
///
|
|
|
|
|
/// By default, it is disabled.
|
2020-02-18 09:54:24 +01:00
|
|
|
pub antialiasing: bool,
|
2019-12-29 12:29:47 +01:00
|
|
|
}
|
|
|
|
|
|
2019-11-25 14:17:13 +01:00
|
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
|
|
|
impl From<Settings> for iced_winit::Settings {
|
|
|
|
|
fn from(settings: Settings) -> iced_winit::Settings {
|
2019-12-03 07:08:12 +01:00
|
|
|
iced_winit::Settings {
|
|
|
|
|
window: iced_winit::settings::Window {
|
|
|
|
|
size: settings.window.size,
|
|
|
|
|
resizable: settings.window.resizable,
|
|
|
|
|
decorations: settings.window.decorations,
|
|
|
|
|
platform_specific: Default::default(),
|
|
|
|
|
},
|
|
|
|
|
}
|
2019-11-25 14:17:13 +01:00
|
|
|
}
|
|
|
|
|
}
|