Skip to content

Commit

Permalink
fixes #555
Browse files Browse the repository at this point in the history
  • Loading branch information
sotrh committed Jun 13, 2024
1 parent 30a6b44 commit a8aad5f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
18 changes: 9 additions & 9 deletions docs/beginner/tutorial2-surface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
_ => {}
},
_ => {}
Expand Down Expand Up @@ -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,
Expand All @@ -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);
}
Expand Down
11 changes: 6 additions & 5 deletions docs/beginner/tutorial6-uniforms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions docs/intermediate/tutorial12-camera/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
..
},
Expand Down

0 comments on commit a8aad5f

Please sign in to comment.