From c956559a5158e1d92ccc5acd7c89b025c68de758 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sun, 28 Dec 2014 16:09:28 +0100 Subject: Add missing `with_*` functions --- src/lib.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index b3dfdd8..6a1c23b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -110,6 +110,11 @@ struct BuilderAttribs<'a> { vsync: bool, visible: bool, multisampling: Option, + depth_bits: Option, + stencil_bits: Option, + color_bits: Option, + alpha_bits: Option, + 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, -- cgit v1.2.3