[][src]Struct sardonyx_window::DisplayConfig

pub struct DisplayConfig {
    pub title: String,
    pub fullscreen: Option<MonitorIdent>,
    pub dimensions: Option<(u32, u32)>,
    pub min_dimensions: Option<(u32, u32)>,
    pub max_dimensions: Option<(u32, u32)>,
    pub visibility: bool,
    pub icon: Option<PathBuf>,
    pub always_on_top: bool,
    pub decorations: bool,
    pub maximized: bool,
    pub multitouch: bool,
    pub resizable: bool,
    pub transparent: bool,
    pub loaded_icon: Option<Icon>,
}

Configuration for a window display.

Fields

title: String

Name of the application window.

fullscreen: Option<MonitorIdent>

Enables fullscreen mode on specific monitor when set. Defaults to None, which means fullscreen is off.

dimensions: Option<(u32, u32)>

Current window dimensions, measured in pixels (px).

min_dimensions: Option<(u32, u32)>

Minimum window dimensions, measured in pixels (px).

max_dimensions: Option<(u32, u32)>

Maximum window dimensions, measured in pixels (px).

visibility: bool

Whether the window should be immediately visible upon creation.

icon: Option<PathBuf>

A path to the icon used for the window. If loaded_icon is present, this will be ignored.

always_on_top: bool

Whether the window should always be on top of other windows.

decorations: bool

Whether the window should have borders and bars.

maximized: bool

Whether the window should be maximized upon creation.

multitouch: bool

Enable multitouch on iOS.

resizable: bool

Whether the window is resizable or not.

transparent: bool

Whether the the window should be transparent. If this is true, writing colors with alpha values different than 1.0 will produce a transparent window.

loaded_icon: Option<Icon>

A programmatically loaded window icon; not present in serialization. Takes precedence over icon.

Examples

use sardonyx_window::{DisplayConfig, Icon};

// First, create your `DisplayConfig` as usual
let mut config = DisplayConfig::default(); // or load from file

// Create the icon data
let mut icon = Vec::new();
for _ in 0..(128 * 128) {
    icon.extend(vec![255, 0, 0, 255]);
}

// Set the `loaded_icon` field of the config
// It will now be used as the window icon
config.loaded_icon = Some(Icon::from_rgba(icon, 128, 128).unwrap());

// Now, feed this into the `GameDataBuilder` using
// `.with_bundle(WindowBundle::from_config(config))`

Methods

impl DisplayConfig[src]

pub fn into_window_builder(
    self,
    monitors: &impl MonitorsAccess
) -> WindowBuilder
[src]

Creates a winit::WindowBuilder using the values set in the DisplayConfig.

The MonitorsAccess is needed to configure a fullscreen window.

Trait Implementations

impl PartialEq<DisplayConfig> for DisplayConfig[src]

impl Default for DisplayConfig[src]

impl Clone for DisplayConfig[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Eq for DisplayConfig[src]

impl Debug for DisplayConfig[src]

impl<'de> Deserialize<'de> for DisplayConfig[src]

impl Serialize for DisplayConfig[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Config for T where
    T: Deserialize<'a> + Serialize + Default
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> Any for T where
    T: Any

impl<T> Resource for T where
    T: Any + Send + Sync

impl<T> TryDefault for T where
    T: Default

fn unwrap_default() -> Self

Calls try_default and panics on an error case.

impl<T> Event for T where
    T: Send + Sync + 'static, 

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.