Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

bevy input

pub fn my_system(keys: Res<Input<KeyCode>>, btns: Res<Input<MouseButton>>) {
    // Keyboard input
    if keys.pressed(KeyCode::Space) {
        eprintln!("space is being held down");
    }

    // Mouse buttons
    if btns.just_pressed(MouseButton::Left) {
        eprintln!("a left click just happened");
    }
}
Source by vleue.com #
 
PREVIOUS NEXT
Tagged: #bevy #input
ADD COMMENT
Topic
Name
7+5 =