Struct mini_gl_fb::config::Config[][src]

#[non_exhaustive]
pub struct Config { pub buffer_size: Option<LogicalSize<u32>>, pub resizable: bool, pub window_title: String, pub window_size: LogicalSize<f64>, pub invert_y: bool, }
Expand description

Configuration for “advanced” use cases, when gotta_go_fast isn’t doing what you need.

The following pattern is recommended when creating a config:

use mini_gl_fb::config;
use mini_gl_fb::glutin::dpi::LogicalSize;

let config = config! {
    /* specify whichever fields you need to set, for example: */
    window_size: LogicalSize::new(100.0, 100.0),
    resizable: true,
};

Since Config is #[non_exhaustive], you cannot construct it directly, and can only obtain one from a trait like Default. The config! macro makes it much less tedious to construct custom configs. See its documentation for more information.

Alternatively, you can choose to use the builder pattern instead:

use mini_gl_fb::ConfigBuilder;

let config = ConfigBuilder::default()
    .invert_y(false)
    .build();

If there’s a config option you want to see or think is missing, please open an issue!

Fields (Non-exhaustive)

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
buffer_size: Option<LogicalSize<u32>>

Sets the pixel dimensions of the buffer. The buffer will automatically stretch to fill the whole window. By default this will be the same as the window_size.

resizable: bool

If this is true, the window created by mini_gl_fb will be set to resizable. This can be changed later. Please note that the buffer itself will not be automatically resized, only the viewport.

window_title: String

The title of the window that will be created.

window_size: LogicalSize<f64>

The logical size of the window that gets created. On HiDPI screens the actual size may be larger than this

invert_y: bool

By default, the origin of the buffer is the bottom-left. This is known as “inverted Y”, as most screen-space coordinate systems begin from the top-left. By explicitly setting this option to false, you can switch to screen-space coordinates rather than OpenGL coordinates. Otherwise, you will have to invert all mouse events received from winit/glutin.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.