mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
Add missing with_*
functions
This commit is contained in:
parent
e1b5d9c103
commit
c956559a51
35
src/lib.rs
35
src/lib.rs
|
@ -110,6 +110,11 @@ struct BuilderAttribs<'a> {
|
|||
vsync: bool,
|
||||
visible: bool,
|
||||
multisampling: Option<u16>,
|
||||
depth_bits: Option<u8>,
|
||||
stencil_bits: Option<u8>,
|
||||
color_bits: Option<u8>,
|
||||
alpha_bits: Option<u8>,
|
||||
stereoscopy: bool,
|
||||
}
|
||||
|
||||
impl BuilderAttribs<'static> {
|
||||
|
@ -126,6 +131,11 @@ impl BuilderAttribs<'static> {
|
|||
vsync: false,
|
||||
visible: true,
|
||||
multisampling: None,
|
||||
depth_bits: None,
|
||||
stencil_bits: None,
|
||||
color_bits: None,
|
||||
alpha_bits: None,
|
||||
stereoscopy: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -212,6 +222,31 @@ impl<'a> WindowBuilder<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
/// Sets the number of bits in the depth buffer.
|
||||
pub fn with_depth_buffer(mut self, bits: u8) -> WindowBuilder<'a> {
|
||||
self.attribs.depth_bits = Some(bits);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the number of bits in the stencil buffer.
|
||||
pub fn with_stencil_buffer(mut self, bits: u8) -> WindowBuilder<'a> {
|
||||
self.attribs.stencil_bits = Some(bits);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the number of bits in the color buffer.
|
||||
pub fn with_pixel_format(mut self, color_bits: u8, alpha_bits: u8) -> WindowBuilder<'a> {
|
||||
self.attribs.color_bits = Some(color_bits);
|
||||
self.attribs.alpha_bits = Some(alpha_bits);
|
||||
self
|
||||
}
|
||||
|
||||
/// Request the backend to be stereoscopic.
|
||||
pub fn with_stereoscopy(mut self) -> WindowBuilder<'a> {
|
||||
self.attribs.stereoscopy = true;
|
||||
self
|
||||
}
|
||||
|
||||
/// Builds the window.
|
||||
///
|
||||
/// Error should be very rare and only occur in case of permission denied, incompatible system,
|
||||
|
|
Loading…
Reference in a new issue