Take a reference to a window in GraphicsContext::new, like glutin and wgpu
This commit is contained in:
parent
85b4f189bd
commit
99d63063b6
13 changed files with 40 additions and 78 deletions
|
|
@ -24,13 +24,13 @@ fn main() {
|
|||
.unwrap();
|
||||
}
|
||||
|
||||
let mut graphics_context = unsafe { GraphicsContext::new(window) }.unwrap();
|
||||
let mut graphics_context = unsafe { GraphicsContext::new(&window) }.unwrap();
|
||||
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
*control_flow = ControlFlow::Wait;
|
||||
|
||||
match event {
|
||||
Event::RedrawRequested(window_id) if window_id == graphics_context.window().id() => {
|
||||
Event::RedrawRequested(window_id) if window_id == window.id() => {
|
||||
let buffer = (0..((BUFFER_WIDTH * BUFFER_HEIGHT) as usize))
|
||||
.map(|index| {
|
||||
let y = index / (BUFFER_WIDTH as usize);
|
||||
|
|
@ -50,7 +50,7 @@ fn main() {
|
|||
Event::WindowEvent {
|
||||
event: WindowEvent::CloseRequested,
|
||||
window_id,
|
||||
} if window_id == graphics_context.window().id() => {
|
||||
} if window_id == window.id() => {
|
||||
*control_flow = ControlFlow::Exit;
|
||||
}
|
||||
_ => {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue