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

Add run condition for whether egui is using pointer input #218

Open
jakobhellermann opened this issue Oct 10, 2023 · 0 comments
Open

Add run condition for whether egui is using pointer input #218

jakobhellermann opened this issue Oct 10, 2023 · 0 comments

Comments

@jakobhellermann
Copy link
Contributor

It came up in jakobhellermann/bevy-inspector-egui#147 that it is often useful to run some systems (like looking around) only if egui is not using the pointer input.

mod common_conditions {
  fn egui_mouse_unused(egui_contexts: Query<&EguiContext>) -> bool {
      egui_contexts
          .iter()
          .all(|ctx| !ctx.get().wants_pointer_input())
  }
}
app.add_systems(
    Update,
    (camera_pan, camera_zoom).run_if(bevy_egui::common_conditions::mouse_pointer_valid()),
)

For prior art, bevy also has some common_conditions for various subcrates:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant