Files
war-in-tunnels/src/app/threads/events.rs
T
GarandPLG 7541db79d8 Refactor App to use unified AppChannels for events
App now receives an AppChannels struct; AppEvent enum removed.

Event handling, tick generation, and audio communication are now
performed through dedicated channels.
2026-05-03 22:27:08 +02:00

22 lines
585 B
Rust

use ratatui::crossterm::event::{Event, KeyEvent, read};
use std::sync::mpsc::Sender;
pub fn handle_ct_events(input_tx: Sender<KeyEvent>, resize_tx: Sender<(u16, u16)>) {
loop {
match read() {
Ok(Event::Key(k)) => {
if input_tx.send(k).is_err() {
break;
}
}
Ok(Event::Resize(cols, rows)) => {
if resize_tx.send((cols, rows)).is_err() {
break;
}
}
Ok(_) => {}
Err(_) => continue,
}
}
}