NEOLearn

Input

How the NEO engine reads keyboards, mice, gamepads and touch screens, and how pointers pick entities on screen.

Updated October 20, 2026

On this page

The engine turns what the operating system or the browser reports into resources, components and messages your systems read every frame. DefaultPlugins adds all of it: InputPlugin for the devices, the gamepad backend, and the picking plugins that tell you which entity a pointer is over.

Three ways to read input#

WayWhat you useWhen to use it
StateRes<ButtonInput<KeyCode>>, Res<ButtonInput<MouseButton>>, the Gamepad component, Res<Touches>Most gameplay: "is jump held?", "was fire just pressed this frame?"
MessagesMessageReader<KeyboardInput>, MessageReader<MouseMotion>, MessageReader<TouchInput> and othersEvery change in order, for text entry, rebinding screens and recording input.
Run conditionsinput_just_pressed(KeyCode::F3), input_pressed(..), input_toggle_active(..)Running a whole system only when a key is down.

State is updated in PreUpdate, in the InputSystems set, so systems in Update see this frame's input.

src/main.rs
use neo::input::common_conditions::input_just_pressed;
use neo::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Update, (jump, toggle_menu.run_if(input_just_pressed(KeyCode::Escape))))
        .run();
}

fn jump(keys: Res<ButtonInput<KeyCode>>) {
    if keys.just_pressed(KeyCode::Space) {
        info!("jump");
    }
}

fn toggle_menu() {
    info!("menu");
}

Pages#

PageWhat it covers
KeyboardKey codes and logical keys, modifiers, text and keyboard messages.
MouseButtons, motion, the wheel, the cursor's position and grabbing the cursor.
GamepadGamepads as entities, buttons and sticks, dead zones and rumble.
TouchTouches on phones and tablets, and NEO's on-screen controls.
PickingPointer events on meshes, sprites and UI: hover, click and drag.

Focus and keyboard navigation between UI elements are in Focus and navigation.

In NEO games#

NEO's games don't read devices directly for the character. The input kit, neo_input_kit, maps keyboard, mouse, gamepad and, on phones, touch onto one character input, with the Starter template's bindings, a dead zone and an InputGate that blocks it while a menu is open. Read Gameplay kit before writing your own mapping; your own systems can still read any device for keys the kit doesn't use.

Next steps#