Struct glutin::WindowBuilder

source ·
pub struct WindowBuilder<'a> {
    pub opengl: GlAttributes<&'a Window>,
    /* private fields */
}
Expand description

Object that allows you to build windows.

Fields§

§opengl: GlAttributes<&'a Window>

The attributes to use to create the context.

Implementations§

source§

impl<'a> WindowBuilder<'a>

source

pub fn new() -> WindowBuilder<'a>

Initializes a new WindowBuilder with default values.

source

pub fn from_winit_builder(winit_builder: WindowBuilder) -> WindowBuilder<'a>

Initializes a new glutin WindowBuilder with the specified winit WindowBuilder and default values for the other parameters.

source

pub fn with_dimensions(self, width: u32, height: u32) -> WindowBuilder<'a>

Requests the window to be of specific dimensions.

Width and height are in pixels.

source

pub fn with_min_dimensions(self, width: u32, height: u32) -> WindowBuilder<'a>

Sets a minimum dimension size for the window

Width and height are in pixels.

source

pub fn with_max_dimensions(self, width: u32, height: u32) -> WindowBuilder<'a>

Sets a maximum dimension size for the window

Width and height are in pixels.

source

pub fn with_title<T: Into<String>>(self, title: T) -> WindowBuilder<'a>

Requests a specific title for the window.

source

pub fn with_fullscreen(self, monitor: MonitorId) -> WindowBuilder<'a>

Requests fullscreen mode.

If you don’t specify dimensions for the window, it will match the monitor’s.

source

pub fn with_shared_lists(self, other: &'a Window) -> WindowBuilder<'a>

The created window will share all its OpenGL objects with the window in the parameter.

There are some exceptions, like FBOs or VAOs. See the OpenGL documentation.

source

pub fn with_gl(self, request: GlRequest) -> WindowBuilder<'a>

Sets how the backend should choose the OpenGL API and version.

source

pub fn with_gl_profile(self, profile: GlProfile) -> WindowBuilder<'a>

Sets the desired OpenGL context profile.

source

pub fn with_gl_debug_flag(self, flag: bool) -> WindowBuilder<'a>

Sets the debug flag for the OpenGL context.

The default value for this flag is cfg!(debug_assertions), which means that it’s enabled when you run cargo build and disabled when you run cargo build --release.

source

pub fn with_gl_robustness(self, robustness: Robustness) -> WindowBuilder<'a>

Sets the robustness of the OpenGL context. See the docs of Robustness.

source

pub fn with_vsync(self) -> WindowBuilder<'a>

Requests that the window has vsync enabled.

source

pub fn with_visibility(self, visible: bool) -> WindowBuilder<'a>

Sets whether the window will be initially hidden or visible.

source

pub fn with_multisampling(self, samples: u16) -> WindowBuilder<'a>

Sets the multisampling level to request. A value of 0 indicates that multisampling must not be enabled.

Panic

Will panic if samples is not a power of two.

source

pub fn with_depth_buffer(self, bits: u8) -> WindowBuilder<'a>

Sets the number of bits in the depth buffer.

source

pub fn with_stencil_buffer(self, bits: u8) -> WindowBuilder<'a>

Sets the number of bits in the stencil buffer.

source

pub fn with_pixel_format( self, color_bits: u8, alpha_bits: u8 ) -> WindowBuilder<'a>

Sets the number of bits in the color buffer.

source

pub fn with_stereoscopy(self) -> WindowBuilder<'a>

Request the backend to be stereoscopic.

source

pub fn with_srgb(self, srgb_enabled: Option<bool>) -> WindowBuilder<'a>

Sets whether sRGB should be enabled on the window. None means “I don’t care”.

source

pub fn with_transparency(self, transparent: bool) -> WindowBuilder<'a>

Sets whether the background of the window should be transparent.

source

pub fn with_decorations(self, decorations: bool) -> WindowBuilder<'a>

Sets whether the window should have a border, a title bar, etc.

source

pub fn with_multitouch(self) -> WindowBuilder<'a>

Enables multitouch

source

pub fn build(self) -> Result<Window, CreationError>

Builds the window.

Error should be very rare and only occur in case of permission denied, incompatible system, out of memory, etc.

source

pub fn build_strict(self) -> Result<Window, CreationError>

Builds the window.

The context is build in a strict way. That means that if the backend couldn’t give you what you requested, an Err will be returned.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for WindowBuilder<'a>

§

impl<'a> !Send for WindowBuilder<'a>

§

impl<'a> !Sync for WindowBuilder<'a>

§

impl<'a> Unpin for WindowBuilder<'a>

§

impl<'a> !UnwindSafe for WindowBuilder<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.