bevy/examples/2d
Ramon Bernardo 80028d1323
Fix error when closing window in 2d_viewport_to_world example (#14804)
# Objective

- Fix error when closing window in 2d_viewport_to_world example.

Before
```
2024-08-17T22:51:47.690252Z  INFO bevy_winit::system: Creating new window "App" (0v1#4294967296)
2024-08-17T22:52:22.062959Z  INFO bevy_window::system: No windows are open, exiting
2024-08-17T22:52:22.064045Z  INFO bevy_winit::system: Closing window 0v1#4294967296
thread 'Compute Task Pool (5)' panicked at examples/2d/2d_viewport_to_world.rs:20:41:
called `Result::unwrap()` on an `Err` value: NoEntities("bevy_ecs::query::state::QueryState<&bevy_window:🪟:Window>")
```

After
```
2024-08-17T22:57:31.623499Z  INFO bevy_winit::system: Creating new window "App" (0v1#4294967296)
2024-08-17T22:57:32.990058Z  INFO bevy_window::system: No windows are open, exiting
2024-08-17T22:57:32.991152Z  INFO bevy_winit::system: Closing window 0v1#4294967296
2024-08-17T22:57:32.994426Z  INFO bevy_window::system: No windows are open, exiting
 *  Terminal will be reused by tasks, press any key to close it. 
```

## Solution

- Check if the window still exists before drawing the cursor
2024-08-19 21:48:32 +00:00
..
2d_shapes.rs Disabled usage of the POLYGON_MODE_LINE gpu feature in the examples (#14402) 2024-07-29 23:40:39 +00:00
2d_viewport_to_world.rs Fix error when closing window in 2d_viewport_to_world example (#14804) 2024-08-19 21:48:32 +00:00
bloom_2d.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
bounding_2d.rs Refactor Bounded2d/Bounded3d to use isometries (#14485) 2024-07-29 23:37:02 +00:00
custom_gltf_vertex_attribute.rs Highlight dependency on shader files in examples (#13824) 2024-06-12 14:16:01 +00:00
mesh2d_alpha_mode.rs Add AlphaMask2d phase (#14724) 2024-08-15 14:10:37 +00:00
mesh2d_arcs.rs Refactor Bounded2d/Bounded3d to use isometries (#14485) 2024-07-29 23:37:02 +00:00
mesh2d_manual.rs Move Msaa to component (#14273) 2024-07-22 18:28:23 +00:00
mesh2d_vertex_color_texture.rs
mesh2d.rs
move_sprite.rs
pixel_grid_snap.rs Move Msaa to component (#14273) 2024-07-22 18:28:23 +00:00
rotation.rs
sprite_animation.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
sprite_flipping.rs
sprite_sheet.rs
sprite_slice.rs Use default window and font sizes in sprite_slice example (#13951) 2024-06-20 19:40:38 +00:00
sprite_tile.rs
sprite.rs
text2d.rs Cosmic text (#10193) 2024-07-04 20:41:08 +00:00
texture_atlas.rs More idiomatic texture atlas builder (#13238) 2024-06-03 12:43:50 +00:00
transparency_2d.rs
wireframe_2d.rs Consistency between Wireframe2d and Wireframe (#14720) 2024-08-13 18:57:47 +00:00