reaction 0.2.0

Universal low-latency input handling for game engines
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::error::Result;
use crate::types::{KeyCode, MouseButton};
use std::collections::HashMap;

#[derive(Debug, Clone, Default)]
pub struct RawInputData {
    pub keys: HashMap<KeyCode, bool>,
    pub mouse_buttons: HashMap<MouseButton, bool>,
    pub mouse_delta: (i32, i32),
}

pub trait RawInputProvider {
    fn initialize(&mut self) -> Result<()>;
    fn poll(&mut self) -> Result<Option<RawInputData>>;
    fn shutdown(&mut self) -> Result<()>;
}