diff --git a/README.md b/README.md index 7ff697c..3526aff 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ use winit::window::WindowBuilder; fn main() { let event_loop = EventLoop::new(); let window = WindowBuilder::new().build(&event_loop).unwrap(); - let mut graphics_context = unsafe { GraphicsContext::new(&window) }.unwrap(); + let mut graphics_context = unsafe { GraphicsContext::new(&window, &window) }.unwrap(); event_loop.run(move |event, _, control_flow| { *control_flow = ControlFlow::Wait; diff --git a/examples/animation.rs b/examples/animation.rs index 28f455d..3cf348e 100644 --- a/examples/animation.rs +++ b/examples/animation.rs @@ -25,7 +25,7 @@ fn main() { .unwrap(); } - let mut graphics_context = unsafe { GraphicsContext::new(&window) }.unwrap(); + let mut graphics_context = unsafe { GraphicsContext::new(&window, &window) }.unwrap(); let mut old_size = (0, 0); let mut frames = pre_render_frames(0, 0); diff --git a/examples/fruit.rs b/examples/fruit.rs index 760149f..d0497d6 100644 --- a/examples/fruit.rs +++ b/examples/fruit.rs @@ -32,7 +32,7 @@ fn main() { .unwrap(); } - let mut graphics_context = unsafe { GraphicsContext::new(&window) }.unwrap(); + let mut graphics_context = unsafe { GraphicsContext::new(&window, &window) }.unwrap(); event_loop.run(move |event, _, control_flow| { *control_flow = ControlFlow::Wait; diff --git a/examples/winit.rs b/examples/winit.rs index 1eff181..8f26550 100644 --- a/examples/winit.rs +++ b/examples/winit.rs @@ -21,7 +21,7 @@ fn main() { .unwrap(); } - let mut graphics_context = unsafe { GraphicsContext::new(&window) }.unwrap(); + let mut graphics_context = unsafe { GraphicsContext::new(&window, &window) }.unwrap(); event_loop.run(move |event, _, control_flow| { *control_flow = ControlFlow::Wait; diff --git a/examples/winit_wrong_sized_buffer.rs b/examples/winit_wrong_sized_buffer.rs index c59eff5..528d153 100644 --- a/examples/winit_wrong_sized_buffer.rs +++ b/examples/winit_wrong_sized_buffer.rs @@ -24,7 +24,7 @@ fn main() { .unwrap(); } - let mut graphics_context = unsafe { GraphicsContext::new(&window) }.unwrap(); + let mut graphics_context = unsafe { GraphicsContext::new(&window, &window) }.unwrap(); event_loop.run(move |event, _, control_flow| { *control_flow = ControlFlow::Wait; diff --git a/src/lib.rs b/src/lib.rs index 7934c96..d727667 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,17 +33,17 @@ pub struct GraphicsContext { } impl GraphicsContext { - /// Creates a new instance of this struct, using the provided window. + /// Creates a new instance of this struct, using the provided window and display. /// /// # Safety /// - /// - Ensure that the provided window is valid to draw a 2D buffer to, and is valid for the + /// - Ensure that the provided objects are valid to draw a 2D buffer to, and are valid for the /// lifetime of the GraphicsContext - pub unsafe fn new(window: &W) -> Result { - Self::from_raw(window.raw_window_handle(), window.raw_display_handle()) + pub unsafe fn new(window: &W, display: &D) -> Result { + Self::from_raw(window.raw_window_handle(), display.raw_display_handle()) } - /// Creates a new instance of this struct, using the provided raw handles + /// Creates a new instance of this struct, using the provided raw window and display handles /// /// # Safety ///