bevy_global_input 0.2.1

Global mouse + keyboard input for bevy - doesn't require a focused window.
Documentation

bevy_global_input

Global Mouse and Keyboard events for bevy.

Crates.io Docs.rs

Features

  • Global keyboard events
  • Global mouse position
  • Global Hotkeys
  • Moving the mouse

Not Implemented / TODO

  • Sending Keystrokes
  • Converting to Bevy KeyCode (don't expose underlying library enums)

Quickstart

log out global mouse position every half second.

use bevy::{prelude::*, time::FixedTimestep};
use bevy_global_input::{GlobalInputPlugins, GlobalMousePos};

fn main() {
    App::new()
        .add_plugins(MinimalPlugins)
        .add_plugins(GlobalInputPlugins)
        .add_system_set(
            SystemSet::new()
                .with_run_criteria(FixedTimestep::step(1.0 / 2.0))
                .with_system(mouse_pos),
        )
        .run();
}

fn mouse_pos(pos: Res<GlobalMousePos>) {
    dbg!(pos);
}

Find more in Examples

compatible bevy versions

bevy bevy_global_input
0.9 0.2.0
0.9 0.1.0