not-elm / bevy-input-sequence

This crate provides reading user input sequences, and sending event

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

【Feature】 Allows creation of events from callback.

not-elm opened this issue · comments

I would like to be able to generate events from callbacks with the proposal mentioned in the PR#4.
This allows gamepad buttons to be passed to events.

   commands.spawn(ButtonSequence::new(
        [
            GamepadButtonType::North,
            GamepadButtonType::East,
            GamepadButtonType::South,
            GamepadButtonType::West,
        ],
        |gamepad: Gamepad|{
            MyEvent(gamepad)
        }
    ).time_limit(Duration::from_secs(1)));

PS Controller have been broken, so it may take some time to test .

I got you, fam. See PR #6.

 commands.add(ButtonSequence::new(
         action::send_event_with_input(|gamepad| MyEvent(gamepad)),
        [
            GamepadButtonType::North,
            GamepadButtonType::East,
            GamepadButtonType::South,
            GamepadButtonType::West,
        ]
    ).time_limit(Duration::from_secs(1)));

I thought about switching the arguments to ButtonSequence::new() and KeySequence::new() too. Looks good for ButtonSequence. Looks a little redundant for KeySequence because it reads:

KeySequence::new(keyseq! { ctrl-alt-Delete }, quit_everything)

But maybe that's ok.

I would like to update this library. 0.3.1 is fine?

I’d suggest 0.4.0 because it’s a breaking change.

I see, thank you.

I released version 0.4.0!
This issue close.

Release note