32 lines
707 B
Rust
32 lines
707 B
Rust
use maraiah::durandal::image::*;
|
|
|
|
pub trait CacheImage
|
|
{
|
|
fn w(&self) -> Coord;
|
|
fn h(&self) -> Coord;
|
|
}
|
|
|
|
pub trait DrawArea
|
|
{
|
|
type NativeImage: CacheImage;
|
|
|
|
fn w(&self) -> Coord;
|
|
fn h(&self) -> Coord;
|
|
|
|
fn clear(&self, cr: impl Color);
|
|
fn rect(&self, rect: Rect, cr: impl Color);
|
|
fn text(&self, pos: Point, cr: impl Color, text: &str);
|
|
fn image(&self, pos: Point, im: &Self::NativeImage);
|
|
}
|
|
|
|
pub type Coord = i32;
|
|
pub type Point = (Coord, Coord);
|
|
|
|
#[derive(Copy, Clone, Debug)]
|
|
pub struct Rect {pub x: Coord, pub y: Coord, pub w: Coord, pub h: Coord}
|
|
|
|
pub const CR_RED: Color16 = Color16::new(0xFFFF, 0, 0);
|
|
pub const CR_DARK_RED: Color16 = Color16::new(0x4700, 0, 0);
|
|
|
|
// EOF
|