pub mod framebuf;
#[cfg(feature = "sdl")]
pub mod sdl;
use crate::types::Rect;
pub struct DisplayInfo {
pub width: u16,
pub height: u16,
pub scale: u16,
}
#[derive(Clone, Debug)]
pub enum InputEvent {
Touch { x: i32, y: i32 },
TouchMove { x: i32, y: i32 },
Release { x: i32, y: i32 },
Key { code: u32, pressed: bool },
Quit,
}
pub trait Backend {
fn display_info(&self) -> DisplayInfo;
fn framebuffer(&mut self) -> &mut [u8];
fn flush(&mut self, area: &Rect);
fn poll_event(&mut self) -> Option<InputEvent>;
fn screen_rect(&self) -> Rect {
let info = self.display_info();
Rect {
x: 0,
y: 0,
w: info.width,
h: info.height,
}
}
}