Skip to main content

Config

Struct Config 

Source
pub struct Config {
    pub title: String,
    pub studio: String,
    pub game: String,
    pub window_size: UVec2,
    pub min_window_size: UVec2,
    pub resizable: bool,
    pub fullscreen: bool,
    pub frame_rate_limit: Option<u32>,
    pub vsync: bool,
    pub virtual_resolution: UVec2,
    pub assets: PathBuf,
    pub volumes: Volumes,
}
Expand description

What a game asks of the engine.

Fields§

§title: String

The text in the window’s title bar.

§studio: String

Who makes the game. On Windows the game’s folders for settings, saves and logs are inside a folder of this name.

§game: String

The name of the game’s folders for settings, saves and logs. Keep it the same from one release to the next, or players lose their settings and saves. Two games with the same name and studio share their folders.

This and studio must each be a valid folder name on every system (the rules are at nadir_platform::user_dirs). If one is not, the game runs without a log file, and a warning says why.

§window_size: UVec2

The size of the inside of the window, in logical pixels.

§min_window_size: UVec2

The smallest size the user can give the window, in logical pixels. A zero means no limit in that direction.

§resizable: bool

Whether the user can resize the window.

§fullscreen: bool

Whether the window starts in borderless fullscreen.

§frame_rate_limit: Option<u32>

The most frames to run in a second. None and Some(0) mean no limit. With vsync the display paces the loop too, but some drivers accept vsync and do not wait (llvmpipe, XWayland), so the limit stays as a cap. Without either, the loop runs as fast as it can and keeps a processor core busy.

§vsync: bool

Whether each frame waits for the display’s refresh, so that it does not tear (a swap interval of 1).

§virtual_resolution: UVec2

The size of the image the world is drawn into, in pixels. It is scaled up into the window by the largest whole factor that fits (pixel-perfect mode, ADR-0018).

§assets: PathBuf

The folder the game’s assets are loaded from: the cook’s output, whose pack game.kpak builds without dev read when it is there (App::new).

§volumes: Volumes

The volume of each of the mixer’s buses as the game starts: full, by default.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Config

Source§

impl PartialEq for Config

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Config

Auto Trait Implementations§

§

impl Forget for Config

§

impl Freeze for Config

§

impl Move for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnsafeUnpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.