Skip to content

Commit

Permalink
check the actual event instead of just its presence
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Oct 16, 2024
1 parent 5811169 commit 20f4972
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/testbed/2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ enum Scene {

fn switch_scene(
keyboard: Res<ButtonInput<KeyCode>>,
#[cfg(feature = "bevy_ci_testing")] mut ci_events: ResMut<Events<CiTestingCustomEvent>>,
#[cfg(feature = "bevy_ci_testing")] mut ci_events: EventReader<CiTestingCustomEvent>,
scene: Res<State<Scene>>,
mut next_scene: ResMut<NextState<Scene>>,
) {
let mut should_switch = false;
should_switch |= keyboard.just_pressed(KeyCode::Space);
#[cfg(feature = "bevy_ci_testing")]
{
should_switch |= !ci_events.is_empty();
should_switch |= ci_events.read().any(|event| match event {
CiTestingCustomEvent(event) => event == "switch_scene",
});
}
if should_switch {
info!("Switching scene");
#[cfg(feature = "bevy_ci_testing")]
ci_events.clear();
next_scene.set(match scene.get() {
Scene::Shapes => Scene::Bloom,
Scene::Bloom => Scene::Text,
Expand Down

0 comments on commit 20f4972

Please sign in to comment.