45 lines
1.2 KiB
Rust
45 lines
1.2 KiB
Rust
#![allow(dead_code, unused)]
|
|
|
|
#[derive(Clone, Debug, Copy)]
|
|
pub struct RGBA {
|
|
pub r: u8,
|
|
pub g: u8,
|
|
pub b: u8,
|
|
pub a: u8,
|
|
}
|
|
|
|
pub const WIDTH: usize = 600;
|
|
pub const HEIGHT: usize = 400;
|
|
|
|
pub type FrameBuffer = [RGBA; WIDTH * HEIGHT];
|
|
|
|
#[derive(Clone, Debug, Copy)]
|
|
pub struct Point {
|
|
pub x: u16,
|
|
pub y: u16,
|
|
}
|
|
pub trait AglApi {
|
|
fn put_line(&mut self, coords_start: Point, coords_end: Point, thickness: u32, color: RGBA);
|
|
fn put_rect(&mut self, coords_start: Point, coords_end: Point, color: RGBA);
|
|
fn put_circle(&mut self, coords: Point, radius: u32);
|
|
fn put_pixel(&mut self, coords: Point, color: RGBA);
|
|
fn put_triangle(
|
|
&mut self,
|
|
coords_1: Point,
|
|
coords_2: Point,
|
|
coords_3: Point,
|
|
thickness: u32,
|
|
color: RGBA,
|
|
);
|
|
fn paint_cursor(&mut self, coords: Point);
|
|
fn hide_cursor();
|
|
fn show_cursor();
|
|
|
|
fn draw_text(&mut self, coords: Point, scale: u8, color: RGBA, text: String);
|
|
|
|
/// Actually move the double buffer to the single buffer and "update" the screen
|
|
fn draw(&mut self);
|
|
/// Setup the clear color to be used
|
|
fn clear(&mut self, color: RGBA);
|
|
}
|