📜  bevy 输入 - Rust 代码示例

📅  最后修改于: 2022-03-11 14:49:25.134000             🧑  作者: Mango

代码示例1
pub fn my_system(keys: Res>, btns: Res>) {
    // 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");
    }
}