Jazarro / bevy_ineffable

A simple-to-use input manager for the Bevy game engine that empowers players and makes accessibility easy.
https://crates.io/crates/bevy_ineffable
Apache License 2.0
15 stars 1 forks source link

Manually triggering input actions #3

Open badcodecat opened 1 month ago

badcodecat commented 1 month ago

Is your feature request related to a problem? Please describe. When using game UI one often wants to be able to additionally accept hotkeys instead of only relying on mouse interaction. I was unable to find how to setup hotkeys/manual sending of input actions from UI/code.

Describe the solution you'd like

Otherwise, if it's currently possible to manually send events from code:

Describe alternatives you've considered Faking key inputs to trigger input actions.

Additional context I discovered this when trying to connect my UI with hotkeys, I didn't know what to do when I got to this part while coding:

#[derive(InputAction)]
pub enum CommandCardInput
{
    #[ineffable(pulse)]
    RotateLeft,
    ...
}

fn handle_rotate_left
(
    interaction_query: Query<&Interaction, (Changed<Interaction>, With<RotateLeftButton>)>,
)
{
    if !matches!(interaction_query.get_single(), Ok(&Interaction::Pressed))
        { return; }
    // What to put here to trigger CommandCardInput::RotateLeft?
}
Jazarro commented 2 weeks ago

Hey, thank you for the feature suggestion. I'm currently very busy, and have not been able to work on this project for a while.

Triggering input actions is to my knowledge not currently possible, but is towards the top of the list of features I would want to implement. It goes hand-in-hand with macro-support and playing back recordings.

When I get around to working on this project, this will probably be the first thing I'll focus on. When this will be, I don't know.