anne_terminal_input
anne_terminal_input is a Rust library for capturing and processing terminal key events in raw mode. It leverages crossterm for cross-platform terminal I/O, uuidmap::Table for in-memory event queues, and integrates seamlessly with the world_dispatcher ECS-style dispatcher.
Features
- Raw Mode Control
Re-exported functions:enable_raw_mode()— call at application start-updisable_raw_mode()— call on shutdown
- Event Representation
- Event Handling
handle_event(table, counter, event)captures a single key event into aTable<KeyInputEvent>and updates the order
- Polling System
input_system(table)clears previous frame events and polls for pending key events, inserting them into the table
- ECS Integration
Systems can be converted via.add(your_fn)into aworld_dispatcher::Dispatcherand run as part of an ECS pipeline - Storage
Usesuuidmap::Table(a dense,u128-keyed storage).
Getting Started
-
Add to your
Cargo.toml[] = "*" = "*" = "*" -
Enable raw mode (before your main loop)
use enable_raw_mode; enable_raw_mode?; -
Capture key events
use ; use Table; let mut table: = Defaultdefault; input_system?; // polls and captures any pending key event for evt in table.values -
Disable raw mode (on exit)
use disable_raw_mode; disable_raw_mode?;
ECS Example with world_dispatcher
use ;
use Table;
use ;
use ;
AI Use
This code was mostly generated using AI along human guidance and multiple rounds of manual code review.