Skip to main content

Crate astrelis_input

Crate astrelis_input 

Source
Expand description

Input state management for tracking keyboard, mouse, and gamepad state.

This module provides a unified input system that tracks the current state of input devices, making it easy to query whether keys or buttons are pressed, just pressed, or just released.

§Example

use astrelis_input::InputState;

let mut input = InputState::new();

// In your event loop:
input.handle_events(&mut events);

// Query input state:
if input.is_key_pressed(KeyCode::Space) {
    player.jump();
}

if input.is_key_just_pressed(KeyCode::Escape) {
    game.pause();
}

let mouse_delta = input.mouse_delta();

// At the end of each frame:
input.end_frame();

Structs§

InputState
Input state tracker for keyboard, mouse, and other input devices.
InputSystem
An input system that wraps InputState and provides additional functionality.
Modifiers
Modifier key state.

Enums§

Key
Code representing the location of a physical key
MouseButton
Mouse button identifiers.