#bevy #user-input #async #gamedev #tokio #game-state #game

bevy_flurx

Allows you to write sequential description of processes involving delays, user input, and other waits

16 unstable releases (3 breaking)

0.6.0-rc.1 Jul 1, 2024
0.5.3 Jun 4, 2024
0.5.1 May 21, 2024
0.4.0 May 4, 2024
0.3.0 Mar 14, 2024

#189 in Game dev

Download history 42/week @ 2024-03-15 3/week @ 2024-03-22 156/week @ 2024-03-29 333/week @ 2024-04-05 249/week @ 2024-04-12 108/week @ 2024-04-19 159/week @ 2024-04-26 296/week @ 2024-05-03 15/week @ 2024-05-10 162/week @ 2024-05-17 18/week @ 2024-05-24 285/week @ 2024-05-31 42/week @ 2024-06-07 4/week @ 2024-06-14 63/week @ 2024-06-28

123 downloads per month
Used in 5 crates

MIT/Apache

620KB
5.5K SLoC

bevy_flurx

Crates.io MIT/Apache 2.0 Crates.io

This library provides a mechanism for more sequential description of delays, character movement, waiting for user input, and other state waits.

As an example, here is an example of a cut-in effect that involves waiting for user input, a slight delay, and a sprite to move.

cut_in

The full source code can be found here.

fn spawn_reactor(
    mut commands: Commands
) {
    commands.spawn(Reactor::schedule(|task| async move {
        task.will(Update, {
            wait::input::just_pressed().with(KeyCode::KeyR)
                .then(once::switch::on::<CutInBackground>())
                .then(delay::time().with(Duration::from_millis(100)))
                .then(once::switch::on::<HandsomeFerris>())
                .then(wait::both(
                    wait::switch::off::<CutInBackground>(),
                    wait::switch::off::<HandsomeFerris>(),
                ))
                .then(once::switch::on::<MoveSlowly>())
                .then(delay::time().with(Duration::from_millis(500)))
                .then(once::switch::off::<MoveSlowly>())
                .then(once::switch::on::<MoveFast>())
                .then(delay::time().with(Duration::from_millis(300)))
                .then(once::event::app_exit())
        })
            .await;
    }));
}

Example

All examples are here.

Feature flags

flag name short description default
audio audio actions true
record undo/redo actions and events true
effect thread/async side effects true
tokio async-compat and async actions false

audio

Provides the actions that perform simple audio playback and waiting using bevy's default audio functionality.

  • once::audio
  • wait::audio

record

Provides Record to manage operation history.

undo_redo

effect

Allows to convert the operations with side effects such as asynchronous runtime or thread into the referential-transparent actions.

tokio

You will be able to write processes that depend on tokio's runtime in the reactor.

ChangeLog

Please see here.

Compatible Bevy versions

bevy_flurx bevy
0.3.0 0.13.0
0.3.1 0.13.1
0.3.2 ~ 0.5.3 0.13.2
0.6.0-rc.1 0.4.0-rc.4

License

This crate is licensed under the MIT License or the Apache License 2.0.

Dependencies

~41–83MB
~1.5M SLoC