2020-05-28 01:46:17 +02:00
|
|
|
//! Configure a renderer.
|
2020-05-29 23:09:15 +02:00
|
|
|
pub use crate::Antialiasing;
|
2020-02-18 08:48:54 +01:00
|
|
|
|
2020-01-09 18:31:07 +01:00
|
|
|
/// The settings of a [`Renderer`].
|
|
|
|
|
///
|
2020-02-18 08:48:54 +01:00
|
|
|
/// [`Renderer`]: ../struct.Renderer.html
|
2020-06-01 22:07:29 +02:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
2020-01-01 17:49:48 +01:00
|
|
|
pub struct Settings {
|
2020-02-24 20:08:40 +01:00
|
|
|
/// The output format of the [`Renderer`].
|
|
|
|
|
///
|
|
|
|
|
/// [`Renderer`]: ../struct.Renderer.html
|
|
|
|
|
pub format: wgpu::TextureFormat,
|
|
|
|
|
|
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
|
|
|
pub default_font: Option<&'static [u8]>,
|
2020-02-15 10:08:27 +01:00
|
|
|
|
2020-06-19 00:08:28 +02:00
|
|
|
/// The default size of text.
|
|
|
|
|
///
|
|
|
|
|
/// By default, it will be set to 20.
|
|
|
|
|
pub default_text_size: u16,
|
|
|
|
|
|
2020-02-15 10:08:27 +01:00
|
|
|
/// The antialiasing strategy that will be used for triangle primitives.
|
2020-02-18 08:48:54 +01:00
|
|
|
pub antialiasing: Option<Antialiasing>,
|
2020-02-15 10:08:27 +01:00
|
|
|
}
|
|
|
|
|
|
2020-02-24 20:08:40 +01:00
|
|
|
impl Default for Settings {
|
|
|
|
|
fn default() -> Settings {
|
|
|
|
|
Settings {
|
|
|
|
|
format: wgpu::TextureFormat::Bgra8UnormSrgb,
|
|
|
|
|
default_font: None,
|
2020-06-19 00:08:28 +02:00
|
|
|
default_text_size: 20,
|
2020-02-24 20:08:40 +01:00
|
|
|
antialiasing: None,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|