Struct glutin::WindowBuilder
source · pub struct WindowBuilder<'a> {
pub window: WindowAttributes,
pub opengl: GlAttributes<&'a Window>,
/* private fields */
}
Expand description
Object that allows you to build windows.
Fields§
§window: WindowAttributes
The attributes to use to create the window.
opengl: GlAttributes<&'a Window>
The attributes to use to create the context.
Implementations§
source§impl<'a> WindowBuilder<'a>
impl<'a> WindowBuilder<'a>
sourcepub fn new() -> WindowBuilder<'a>
pub fn new() -> WindowBuilder<'a>
Initializes a new WindowBuilder
with default values.
sourcepub fn with_dimensions(self, width: u32, height: u32) -> WindowBuilder<'a>
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.
sourcepub fn with_min_dimensions(self, width: u32, height: u32) -> WindowBuilder<'a>
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.
sourcepub fn with_max_dimensions(self, width: u32, height: u32) -> WindowBuilder<'a>
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.
sourcepub fn with_title(self, title: String) -> WindowBuilder<'a>
pub fn with_title(self, title: String) -> WindowBuilder<'a>
Requests a specific title for the window.
sourcepub fn with_fullscreen(self, monitor: MonitorId) -> WindowBuilder<'a>
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.
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.
sourcepub fn with_gl(self, request: GlRequest) -> WindowBuilder<'a>
pub fn with_gl(self, request: GlRequest) -> WindowBuilder<'a>
Sets how the backend should choose the OpenGL API and version.
sourcepub fn with_gl_profile(self, profile: GlProfile) -> WindowBuilder<'a>
pub fn with_gl_profile(self, profile: GlProfile) -> WindowBuilder<'a>
Sets the desired OpenGL context profile.
sourcepub fn with_gl_debug_flag(self, flag: bool) -> WindowBuilder<'a>
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
.
sourcepub fn with_gl_robustness(self, robustness: Robustness) -> WindowBuilder<'a>
pub fn with_gl_robustness(self, robustness: Robustness) -> WindowBuilder<'a>
Sets the robustness of the OpenGL context. See the docs of Robustness
.
sourcepub fn with_vsync(self) -> WindowBuilder<'a>
pub fn with_vsync(self) -> WindowBuilder<'a>
Requests that the window has vsync enabled.
sourcepub fn with_visibility(self, visible: bool) -> WindowBuilder<'a>
pub fn with_visibility(self, visible: bool) -> WindowBuilder<'a>
Sets whether the window will be initially hidden or visible.
sourcepub fn with_multisampling(self, samples: u16) -> WindowBuilder<'a>
pub fn with_multisampling(self, samples: u16) -> WindowBuilder<'a>
sourcepub fn with_depth_buffer(self, bits: u8) -> WindowBuilder<'a>
pub fn with_depth_buffer(self, bits: u8) -> WindowBuilder<'a>
Sets the number of bits in the depth buffer.
sourcepub fn with_stencil_buffer(self, bits: u8) -> WindowBuilder<'a>
pub fn with_stencil_buffer(self, bits: u8) -> WindowBuilder<'a>
Sets the number of bits in the stencil buffer.
sourcepub fn with_pixel_format(
self,
color_bits: u8,
alpha_bits: u8
) -> WindowBuilder<'a>
pub fn with_pixel_format( self, color_bits: u8, alpha_bits: u8 ) -> WindowBuilder<'a>
Sets the number of bits in the color buffer.
sourcepub fn with_stereoscopy(self) -> WindowBuilder<'a>
pub fn with_stereoscopy(self) -> WindowBuilder<'a>
Request the backend to be stereoscopic.
sourcepub fn with_srgb(self, srgb_enabled: Option<bool>) -> WindowBuilder<'a>
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”.
sourcepub fn with_transparency(self, transparent: bool) -> WindowBuilder<'a>
pub fn with_transparency(self, transparent: bool) -> WindowBuilder<'a>
Sets whether the background of the window should be transparent.
sourcepub fn with_decorations(self, decorations: bool) -> WindowBuilder<'a>
pub fn with_decorations(self, decorations: bool) -> WindowBuilder<'a>
Sets whether the window should have a border, a title bar, etc.
sourcepub fn with_multitouch(self) -> WindowBuilder<'a>
pub fn with_multitouch(self) -> WindowBuilder<'a>
Enables multitouch
sourcepub fn build(self) -> Result<Window, CreationError>
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.
sourcepub fn build_strict(self) -> Result<Window, CreationError>
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.