diff --git a/docs/beginner/tutorial2-surface/README.md b/docs/beginner/tutorial2-surface/README.md index eb49ae964..38b3f5e77 100644 --- a/docs/beginner/tutorial2-surface/README.md +++ b/docs/beginner/tutorial2-surface/README.md @@ -241,14 +241,14 @@ pub async fn run() { } if window_id == state.window().id() => match event { WindowEvent::CloseRequested | WindowEvent::KeyboardInput { - input: - KeyboardInput { + event: + KeyEvent { state: ElementState::Pressed, - virtual_keycode: Some(VirtualKeyCode::Escape), + physical_key: PhysicalKey::Code(KeyCode::Escape), .. }, .. - } => *control_flow = ControlFlow::Exit, + } => control_flow.exit(), _ => {} }, _ => {} @@ -360,7 +360,7 @@ We need to do a little more work in the event loop. We want `State` to have prio ```rust // run() -event_loop.run(move |event, _, control_flow| { +event_loop.run(move |event, control_flow| { match event { Event::WindowEvent { ref event, @@ -369,14 +369,14 @@ event_loop.run(move |event, _, control_flow| { match event { WindowEvent::CloseRequested | WindowEvent::KeyboardInput { - input: - KeyboardInput { + event: + KeyEvent { state: ElementState::Pressed, - virtual_keycode: Some(VirtualKeyCode::Escape), + physical_key: PhysicalKey::Code(KeyCode::Escape), .. }, .. - } => *control_flow = ControlFlow::Exit, + } => control_flow.exit(), WindowEvent::Resized(physical_size) => { state.resize(*physical_size); } diff --git a/docs/beginner/tutorial6-uniforms/README.md b/docs/beginner/tutorial6-uniforms/README.md index 1df38f4a8..2f861f497 100644 --- a/docs/beginner/tutorial6-uniforms/README.md +++ b/docs/beginner/tutorial6-uniforms/README.md @@ -302,11 +302,12 @@ impl CameraController { fn process_events(&mut self, event: &WindowEvent) -> bool { match event { WindowEvent::KeyboardInput { - input: KeyboardInput { - state, - virtual_keycode: Some(keycode), - .. - }, + event: + KeyEvent { + state, + physical_key: PhysicalKey::Code(keycode), + .. + }, .. } => { let is_pressed = *state == ElementState::Pressed; diff --git a/docs/intermediate/tutorial12-camera/README.md b/docs/intermediate/tutorial12-camera/README.md index fe95c1686..ada0c98b4 100644 --- a/docs/intermediate/tutorial12-camera/README.md +++ b/docs/intermediate/tutorial12-camera/README.md @@ -344,9 +344,9 @@ Now, to fix this, we could change the `input()` function to process `DeviceEvent fn input(&mut self, event: &WindowEvent) -> bool { match event { WindowEvent::KeyboardInput { - input: - KeyboardInput { - virtual_keycode: Some(key), + event: + KeyEvent { + physical_key: PhysicalKey::Code(key), state, .. },