This commit is contained in:
not-elm
2025-08-10 21:28:45 +09:00
commit 23bdc65da3
91 changed files with 20122 additions and 0 deletions

23
src/mute.rs Normal file
View File

@@ -0,0 +1,23 @@
use crate::prelude::AudioMuted;
use bevy::prelude::*;
pub(super) struct AudioMutePlugin;
impl Plugin for AudioMutePlugin {
fn build(&self, app: &mut App) {
app.add_systems(Update, sync_audio_mute.run_if(any_changed_audio_mute));
}
}
fn any_changed_audio_mute(audio_mute: Query<&AudioMuted, Changed<AudioMuted>>) -> bool {
!audio_mute.is_empty()
}
fn sync_audio_mute(
browsers: NonSend<bevy_cef_core::prelude::Browsers>,
audio_mute: Query<(Entity, &AudioMuted), Changed<AudioMuted>>,
) {
for (entity, mute) in audio_mute.iter() {
browsers.set_audio_muted(&entity, mute.0);
}
}