Configuration

You can configure your app using the MayConfig struct.

It has many different fields to customize your application to your liking:

window: WindowConfig

Configures the application window.

title: String

The title of the window in desktop environments.

size: Vector2<f64>

The initial size of the window in desktop environments.

min_size: Vector2<f64>

The minimum size the window can have in desktop environments.

max_size: Vector2<f64>

The maximum size the window can have in desktop environments.

resizable: bool

Whether the window can be resized in desktop environments.

maximized: bool

Whether the window is maximized in desktop environments.

mode: WindowMode

The mode of the window in desktop environments. Can be WindowMode::Windowed, WindowMode::Borderless or WindowMode::Fullscreen.

level: WindowLevel

The level of the window in desktop environments. Can be WindowLevel::Normal, WindowLevel::AlwaysOnTop or WindowLevel::AlwaysOnBottom.

visible: bool

If the window should be visible on startup in desktop environments.

blur: bool

If the window background should be blurred in desktop environments.

transparent: bool

If the window background should be transparent in desktop environments. May not be compatible with all desktop environments.

position: Option<Point2<f64>>

The initial position of the window in desktop environments. Uses the default positioning if None.

active: bool

If the window should be active/focused on startup in desktop environments.

buttons: WindowButtons

The window buttons to enable in desktop environments.

decorations: bool

If the window should have decorations (borders) in desktop environments.

resize_increments: Option<Vector2<f64>>

The resize increments of the window in desktop environments. May not be compatible with all desktop environments.

content_protected: bool

Prevents window capturing by some apps (not all though).

icon: Option<WindowIcon>

The window icon in desktop environments.

cursor: Cursor

The window cursor in desktop environments.

close_on_request: bool

If the window should exit on close request (pressing the close window button) in desktop environments.

render: RenderConfig

Configures the application renderer.

antialiasing: AaConfig

The antialiasing config. Can affect rendering performance. Can be AaConfig::Area, AaConfig::Msaa8 or AaConfig::Msaa16.

cpu: bool

If the backend should use the CPU for most drawing operations. The GPU is still used during rasterization.

present_mode: PresentMode

The presentation mode of the window/surface. Can be PresentMode::AutoVsync, PresentMode::AutoNoVsync, PresentMode::Fifo, PresentMode::FifoRelaxed, PresentMode::Immediate or PresentMode::Mailbox.

init_threads: Option<NonZeroUsize>

The number of threads the renderer uses for initialization. When None, the number of logical cores is used.

device_selector: fn(&Vec<DeviceHandle>) -> &DeviceHandle

A selector function to determine which device to use for rendering.

tasks: Option<TasksConfig>

Task Runner Configuration. If None, the task runner won't be enabled.

stack_size: usize

The stack size of each thread of the task runner thread pool. Defaults to 1 MB.

workers: NonZeroUsize

The amount of worker threads of the task runner thread pool. Defaults to half of the available parallelism.

theme: Theme

The application theme.