| Crates.io | press_here |
| lib.rs | press_here |
| version | 0.1.2 |
| created_at | 2025-11-21 00:24:37.973674+00 |
| updated_at | 2025-11-22 13:17:32.126477+00 |
| description | Simple and modular input handling for Bevy |
| homepage | |
| repository | https://github.com/ad-kr/press_here |
| max_upload_size | |
| id | 1942803 |
| size | 217,129 |
press_here provides simple and modular input handling for the Bevy game engine.
Setup is quick and easy. Define axis/trigger and configure bindings:
fn main() {
App::new()
.add_plugins(DefaultPlugins)
// Space key or south button on the gamepad for jump
.add_trigger::<Jump>((KeyCode::Space, GamepadButton::South))
.add_axis::<Walk>((
// A/D keys for left/right movement
Pair(KeyCode::KeyA, KeyCode::KeyD),
// ..or left stick X-axis with deadzone
GamepadAxis::LeftStickX.deadzone(0.1),
))
.add_systems(Update, update)
.run();
}
struct Jump;
struct Walk;
fn update(jump: Res<Trigger<Jump>>, walk: Res<Axis<Walk>>) {
if jump.just_pressed() {
jump_character();
}
let walk_value = walk.value();
if walk_value != 0.0 {
walk_character(walk_value);
}
}
Axis and trigger bindings are modular and can be combined to configure complex input responses. Check out the all_bindings example to see all bindings and modfiers in action.
let binding = Smooth::new(
(
Pair(KeyCode::KeyA, KeyCode::KeyD),
Deadzone(GamepadAxis::LeftStickX, 0.1),
),
0.2,
);
The same binding can be defined using the builder pattern:
let binding = (
Pair(KeyCode::KeyA, KeyCode::KeyD),
GamepadAxis::LeftStickX.deadzone(0.1),
)
.smooth(0.2);
Inputs-mocking should be made easier. This would also allow us to make create better doc-comments/tests..with_trigger::<SomeTrigger>().Time<Real> clock. If a different clock is desired, we have no way to configure that.| Bevy | press_here |
|---|---|
| 0.17 | 0.1 |