chore: Update to Bevy 0.16.

This commit is contained in:
Nolan Darilek 2025-05-16 09:45:14 -05:00
parent b3be60ea8d
commit 0d192fe64f
6 changed files with 26 additions and 52 deletions

View File

@ -2,6 +2,13 @@
All notable changes to this project will be documented in this file.
## Version 0.11.0 - 2025-05-16
### Miscellaneous Tasks
- Add Nix-based build and CI configuration.
- Update to Bevy 016.
## Version 0.10.0 - 2024-12-05
### Features

View File

@ -17,12 +17,12 @@ speech_dispatcher_0_11 = ["tts/speech_dispatcher_0_11"]
tolk = ["tts/tolk"]
[dependencies]
bevy = { version = "0.15", default-features = false }
bevy = { version = "0.16", default-features = false }
crossbeam-channel = "0.5"
tts = { version = "0.26", default-features = false }
[dev-dependencies]
bevy = { version = "0.15", default-features = true }
bevy = { version = "0.16", default-features = true }
[package.metadata.release]
publish = false

View File

@ -83,15 +83,19 @@ fn event_poll(mut events: EventReader<TtsEvent>) {
}
// Shows how to output speech in response to a keypress.
fn greet(input: Res<ButtonInput<KeyCode>>, mut tts: ResMut<Tts>, mut speaker: Query<&mut Tts>) {
fn greet(
input: Res<ButtonInput<KeyCode>>,
mut tts: ResMut<Tts>,
mut speaker: Query<&mut Tts>,
) -> Result {
if input.just_pressed(KeyCode::KeyG) {
tts.speak("Hey there!", true).unwrap();
}
if input.just_pressed(KeyCode::KeyS) {
if let Ok(mut speaker) = speaker.get_single_mut() {
speaker
.speak("Hey there from the TTS component!", true)
.unwrap();
}
let mut speaker = speaker.single_mut()?;
speaker
.speak("Hey there from the TTS component!", true)
.unwrap();
}
Ok(())
}

View File

@ -1,24 +1,5 @@
{
"nodes": {
"naersk": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1745925850,
"narHash": "sha256-cyAAMal0aPrlb1NgzMxZqeN1mAJ2pJseDhm2m6Um8T0=",
"owner": "nix-community",
"repo": "naersk",
"rev": "38bc60bbc157ae266d4a0c96671c6c742ee17a5f",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "naersk",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1747312588,
@ -35,26 +16,9 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1747312588,
"narHash": "sha256-MmJvj6mlWzeRwKGLcwmZpKaOPZ5nJb/6al5CXqJsgjo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b1bebd0fe266bbd1820019612ead889e96a8fa2d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"naersk": "naersk",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},

View File

@ -2,7 +2,6 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk/master";
};
outputs =
@ -10,13 +9,11 @@
self,
nixpkgs,
utils,
naersk,
}:
utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
naersk-lib = pkgs.callPackage naersk { };
in
{
devShell =
@ -30,6 +27,8 @@
pkg-config
pre-commit
git-cliff
cargo-release
cargo-outdated
];
buildInputs = [
speechd

View File

@ -1,5 +1,5 @@
use bevy::{
ecs::{component::ComponentId, world::DeferredWorld},
ecs::{component::HookContext, world::DeferredWorld},
prelude::*,
};
use crossbeam_channel::{unbounded, Receiver};
@ -31,13 +31,13 @@ pub enum TtsEvent {
#[derive(Component, Resource)]
struct TtsChannel(Receiver<TtsEvent>);
fn on_tts_added(mut world: DeferredWorld, entity: Entity, _: ComponentId) {
fn on_tts_added(mut world: DeferredWorld, HookContext { entity, .. }: HookContext) {
let tts = &world.get::<Tts>(entity).unwrap();
let channel = setup_tts(tts);
world.commands().entity(entity).insert(channel);
}
fn on_tts_removed(mut world: DeferredWorld, entity: Entity, _: ComponentId) {
fn on_tts_removed(mut world: DeferredWorld, HookContext { entity, .. }: HookContext) {
world.commands().entity(entity).remove::<TtsChannel>();
}
@ -48,7 +48,7 @@ fn poll_callbacks(
speakers: Query<(Entity, &TtsChannel), With<Tts>>,
) {
if let Ok(msg) = channel.0.try_recv() {
events.send(msg);
events.write(msg);
}
for (entity, channel) in &speakers {
if let Ok(msg) = channel.0.try_recv() {