AGL
This commit is contained in:
commit
134f6d0ae4
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/target
|
||||
Cargo.lock
|
8
Cargo.toml
Normal file
8
Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "able_graphics_library"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
40
src/lib.rs
Normal file
40
src/lib.rs
Normal file
|
@ -0,0 +1,40 @@
|
|||
#![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);
|
||||
}
|
Reference in a new issue