Struct Config

Source
pub struct Config { /* private fields */ }
Expand description

Pel configuration.

Implementations§

Source§

impl Config

Source

pub fn vsync(self, vsync: bool) -> Self

Request pel window to have vsync enabled.

By default, vsync is enabled.

Source

pub fn srgb(self, srgb: bool) -> Self

Request pel window to have sRGB enabled.

By default, sRGB is enabled.

Source

pub fn window_size(self, width: u32, height: u32) -> Self

Requests pel window client area to be of specific size in logical pixels.

By default, platform defaults are used.

Source

pub fn min_window_size(self, width: u32, height: u32) -> Self

Requests minimum pel window client area to be no less than specified in logical pixels.

By default, platform defaults are used.

Source

pub fn max_window_size(self, width: u32, height: u32) -> Self

Requests maximum pel window client area to be no more than specified in logical pixels.

By default, platform defaults are used.

Source

pub fn resizable(self, resizable: bool) -> Self

Requests pel window to be resizable.

By default, window is resizable.

Source

pub fn maximized(self, maximized: bool) -> Self

Requests pel window to appear maximized when created.

By default, window isn’t maximized.

Source

pub fn decorations(self, decorations: bool) -> Self

Requests pel window to have border.

By default, window does have a border.

Source

pub fn icon<S: Into<Surface>>(self, icon: S) -> Self

Requests pel window to use given icon.

By default, window has no icon.

Source

pub fn title<T: Into<String>>(self, title: T) -> Self

Requests pel window to have a specific title.

By default, window title is "pel window".

Source

pub fn fullscreen(self, fullscreen: bool) -> Self

Requests pel window to be created in fullscreen mode.

By default, window is not in fullscreen mode.

Source

pub fn always_on_top(self, always_on_top: bool) -> Self

Requests pel window to be in always on top mode.

By default, window isn’t in always on top mode.

Source

pub fn texture_size(self, width: usize, height: usize) -> Self

Requests window pel texture to be of specific size in logical pixels.

This is the “resolution” of your application, in which you will be working in, and it is independent of physical window size.

By default, texture size is None and it must be set manually or builder will panic.

Examples found in repository?
examples/minimal.rs (line 10)
7fn main() {
8    pel::new()
9    // it is mandatory to set desired texture size
10    .texture_size(1, 1)
11    // event loop requires user type that implements pel::Events
12    .run(Example);
13}
More examples
Hide additional examples
examples/events.rs (line 62)
59fn main() {
60    pel::new()
61    // it is mandatory to set desired texture size
62    .texture_size(1, 1)
63    // event loop requires user type that implements pel::Events
64    .run(EventHandler);
65}
Source

pub fn run<E>(self, event_handler: E) -> !
where E: Events + 'static,

Starts pel event loop.

Due to cross-platform limitations, this method should only be called in the main thread.

See documentation of Events for more information.

Examples found in repository?
examples/minimal.rs (line 12)
7fn main() {
8    pel::new()
9    // it is mandatory to set desired texture size
10    .texture_size(1, 1)
11    // event loop requires user type that implements pel::Events
12    .run(Example);
13}
More examples
Hide additional examples
examples/events.rs (line 64)
59fn main() {
60    pel::new()
61    // it is mandatory to set desired texture size
62    .texture_size(1, 1)
63    // event loop requires user type that implements pel::Events
64    .run(EventHandler);
65}

Trait Implementations§

Source§

impl Default for Config

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl !Send for Config

§

impl !Sync for Config

§

impl Unpin 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

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

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.