Crate kon_input

Crate kon_input 

Source
Expand description

#[system] fn player_control(ctx: &mut Context) { let input = ctx.input();

// Raw input
if input.just_key_pressed(KeyCode::Space) {
    jump();
}

// Action-based (recommended)
if input.is_action_pressed("MoveForward") {
    move_forward();
}

if input.just_action_pressed("Fire") {
    shoot();
}

}

fn main() { Kon::new() .add_plugin(DefaultPlugins) .add_system(player_control) .run(); }

Modules§

prelude

Structs§

Input
Input state manager
InputPlugin
Input Plugin - registers Input and processes input events

Enums§

InputSource
Defines an input source that can trigger an action

Traits§

ContextInputExt
Extension trait for convenient Input access from Context