Struct uni_app::AppConfig

source ·
pub struct AppConfig {
    pub title: String,
    pub size: (u32, u32),
    pub icon: Option<(u32, u32, Vec<u8>)>,
    pub vsync: bool,
    pub headless: bool,
    pub fullscreen: bool,
    pub resizable: bool,
    pub show_cursor: bool,
    pub intercept_close_request: bool,
}
Expand description

game window configuration

Fields§

§title: String

the window title (only visible on native target)

§size: (u32, u32)

the window/canvas size in pixels

§icon: Option<(u32, u32, Vec<u8>)>

The window icon : width,height,pixel data in rgba format. winit recommends using a 32x32 image. You can use the image crate to embed the icon in your executable at build time :

pub static ICON: &u8 = include_bytes!(“my_icon.png”); let icon=image::load_from_memory(ICON).unwrap(); app_config.icon = Some((icon.width(),icon.height(),icon.as_bytes().to_vec()))

§vsync: bool

sync frames with screen frequency (can only be disabled on native target)

§headless: bool

start the program without actually creating a window, for test purposes

§fullscreen: bool

start in full screen (native target only)

§resizable: bool

whether user can resize the window (native target only)

§show_cursor: bool

whether the mouse cursor is visible while in the window

§intercept_close_request: bool

whether clicking on the window close button exits the program or sends a CloseRequested event

Implementations§

source§

impl AppConfig

source

pub fn new<T: Into<String>>(title: T, size: (u32, u32)) -> AppConfig

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.