This repository has been archived on 2021-11-29. You can view files and clone it, but cannot push or open issues/pull-requests.
able_graphics_library/src/lib.rs

41 lines
1.0 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];
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();
/// 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);
}