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.