Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Feature】 Allows creation of events from callback. #5

Closed
not-elm opened this issue Mar 16, 2024 · 6 comments
Closed

【Feature】 Allows creation of events from callback. #5

not-elm opened this issue Mar 16, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@not-elm
Copy link
Owner

not-elm commented Mar 16, 2024

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)));
@not-elm not-elm added the enhancement New feature or request label Mar 16, 2024
@not-elm not-elm self-assigned this Mar 19, 2024
@not-elm
Copy link
Owner Author

not-elm commented Mar 21, 2024

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

@shanecelis
Copy link
Collaborator

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.

@not-elm
Copy link
Owner Author

not-elm commented Apr 22, 2024

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

@shanecelis
Copy link
Collaborator

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

@not-elm
Copy link
Owner Author

not-elm commented Apr 23, 2024

I see, thank you.

@not-elm
Copy link
Owner Author

not-elm commented Apr 23, 2024

I released version 0.4.0!
This issue close.

Release note

@not-elm not-elm closed this as completed Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants