Struct miniquad::conf::Platform

source ·
pub struct Platform {
    pub linux_x11_gl: LinuxX11Gl,
    pub linux_backend: LinuxBackend,
    pub apple_gfx_api: AppleGfxApi,
    pub swap_interval: Option<i32>,
    pub blocking_event_loop: bool,
    pub framebuffer_alpha: bool,
    pub wayland_use_fallback_decorations: bool,
}
Expand description

Platform specific settings.

Fields§

§linux_x11_gl: LinuxX11Gl

On X11 there are two ways to get OpenGl context: libglx.so and libegl.so Default is GLXWithEGLFallback - will try to create glx context and if fails - try EGL. If EGL also fails - panic.

§linux_backend: LinuxBackend

Wayland or X11. Defaults to X11WithWaylandFallback - miniquad will try to load “libX11.so”, but if there is no - will try to initialize through wayland natively. If both fails (no graphics server at all, like KMS) - will panic.

Defaults to X11Only. Wayland implementation is way too unstable right now.

§apple_gfx_api: AppleGfxApi

Which rendering context to create, Metal or OpenGL. Miniquad always links with Metal.framework (assuming it is always present) but it links with OpenGL dynamically and only if required.

Defaults to AppleGfxApi::GL for legacy reasons.

§swap_interval: Option<i32>

On some platform it is possible to ask the OS for a specific swap interval. Note that this is highly platform and implementation dependent, there is no guarantee that FPS will be equal to swap_interval. In other words - “swap_interval” is a hint for a GPU driver, this is not the way to limit FPS in the game!

§blocking_event_loop: bool

A way to reduce CPU usage to zero when waiting for an incoming event. update()/draw() will only be called after window::request_update(). It is recommended to put request_update at the end of resize_event and relevant mouse/keyboard input. request_update may be used from other threads to “wake up” the window.

§framebuffer_alpha: bool

Whether the framebuffer should have an alpha channel. Currently supported only on Android TODO: Make it works on web, on web it should make a transparent HTML5 canvas TODO: Document(and check) what does it actually mean on android. Transparent window?

§wayland_use_fallback_decorations: bool

Whether to draw the default window decorations on Wayland. Only works when using the Wayland backend.

Trait Implementations§

source§

impl Debug for Platform

source§

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

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

impl Default for Platform

source§

fn default() -> Platform

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

Auto Trait Implementations§

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>,

§

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>,

§

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.