Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove close_on_esc #12859

Merged
merged 1 commit into from Apr 3, 2024
Merged

Conversation

matiqo15
Copy link
Member

@matiqo15 matiqo15 commented Apr 3, 2024

Objective

  • Remove close_on_esc
  • For context about why we are removing it see: discord

Migration Guide

  • Users who added close_on_esc in their application will have to replace it with their own solution.
pub fn close_on_esc(
    mut commands: Commands,
    focused_windows: Query<(Entity, &Window)>,
    input: Res<ButtonInput<KeyCode>>,
) {
    for (window, focus) in focused_windows.iter() {
        if !focus.focused {
            continue;
        }

        if input.just_pressed(KeyCode::Escape) {
            commands.entity(window).despawn();
        }
    }
}

@matiqo15 matiqo15 added C-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide A-Dev-Tools Tools used to debug Bevy applications. labels Apr 3, 2024
Copy link
Contributor

@pablo-lua pablo-lua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can think if we will have this kind of helper systems in the future, but should probably be much more configurable and inside some toolbox or plugin. Lets remove this!

@pablo-lua pablo-lua added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Apr 3, 2024
@mockersf mockersf added this pull request to the merge queue Apr 3, 2024
@mockersf mockersf removed this pull request from the merge queue due to a manual request Apr 3, 2024
@mockersf
Copy link
Member

mockersf commented Apr 3, 2024

@DJMcNab I think you want to keep it?

@DJMcNab
Copy link
Member

DJMcNab commented Apr 3, 2024

I mean, I'm not using Bevy regularly at the moment, so I'm not really that bothered either way.

I do find the equivalent functionality in Vello's example to be very useful though.

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 3, 2024
Merged via the queue into bevyengine:main with commit 6ccb2a3 Apr 3, 2024
31 checks passed
chompaa pushed a commit to chompaa/bevy that referenced this pull request Apr 5, 2024
# Objective

- Remove `close_on_esc`
- For context about why we are removing it see:
[discord](https://discordapp.com/channels/691052431525675048/692572690833473578/1225075194524073985)

## Migration Guide

- Users who added `close_on_esc` in their application will have to
replace it with their own solution.

```rust
pub fn close_on_esc(
    mut commands: Commands,
    focused_windows: Query<(Entity, &Window)>,
    input: Res<ButtonInput<KeyCode>>,
) {
    for (window, focus) in focused_windows.iter() {
        if !focus.focused {
            continue;
        }

        if input.just_pressed(KeyCode::Escape) {
            commands.entity(window).despawn();
        }
    }
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Dev-Tools Tools used to debug Bevy applications. C-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants