pub trait Surface {
type Texel;
fn texel(&self, x: u32, y: u32) -> Option<Self::Texel>;
fn set_texel(&mut self, x: u32, y: u32, value: Self::Texel);
unsafe fn texel_unchecked(&self, x: u32, y: u32) -> Self::Texel {
self.texel(x, y).unwrap()
}
unsafe fn set_texel_unchecked(&mut self, x: u32, y: u32, value: Self::Texel) {
self.set_texel(x, y, value)
}
fn clear(&mut self, value: Self::Texel);
fn width(&self) -> u32;
fn height(&self) -> u32;
}
pub trait Fill<I>: Surface {
fn fill_from(&mut self, data: I);
}
pub trait InputHandler<Event, EventContext> {
fn handle_event(&mut self, event: Event, event_context: &EventContext) -> Option<Event>;
fn update(&mut self);
}
pub trait EventContext<EventSpace> {
type SurfaceSpace;
fn estimate_surface_space(&self, event_space: EventSpace) -> Self::SurfaceSpace;
}