2021-11-16 00:09:27 -06:00
|
|
|
#![allow(unused)]
|
2022-04-11 17:23:11 -05:00
|
|
|
|
|
|
|
pub const REFRESH_RATE: u8 = 60;
|
|
|
|
|
|
|
|
pub type RefreshRate = u8;
|
|
|
|
pub type Resolution = (usize, usize);
|
|
|
|
pub type Point = (GCoord, GCoord);
|
|
|
|
pub type GCoord = usize;
|
|
|
|
|
2021-11-16 00:09:27 -06:00
|
|
|
pub enum GModes {
|
2021-11-17 08:42:54 -06:00
|
|
|
Vga800x600,
|
|
|
|
Custom(u16, u16),
|
2021-11-16 00:09:27 -06:00
|
|
|
}
|
2021-11-17 08:42:54 -06:00
|
|
|
|
|
|
|
// TODO remap to a bitmasked u32
|
2022-04-11 17:23:11 -05:00
|
|
|
// REASON: More effecient memory wise so less overhead on the wasm memory
|
|
|
|
// Current: u32+u32+u32
|
|
|
|
// Proposed: u32 with bitmaps
|
2021-11-16 00:09:27 -06:00
|
|
|
pub struct Rgb {
|
|
|
|
pub r: u32,
|
|
|
|
pub g: u32,
|
|
|
|
pub b: u32,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Rgb {
|
|
|
|
fn to_vga_color() {
|
|
|
|
todo!();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct FrameBuffer;
|
|
|
|
pub trait Graphics {
|
|
|
|
fn put_line(coords_start: Point, coords_end: Point, thickness: u32, color: Rgb);
|
|
|
|
fn put_rect(coords_start: Point, coords_end: Point, color: Rgb);
|
|
|
|
fn put_circle(coords: Point, radius: u32);
|
|
|
|
fn put_pixel(coords: Point, color: Rgb);
|
|
|
|
fn put_triangle(coords_1: Point, coords_2: Point, coords_3: Point, thickness: u32, color: Rgb);
|
|
|
|
fn paint_cursor(coords: Point);
|
|
|
|
fn hide_cursor();
|
|
|
|
fn show_cursor();
|
|
|
|
/// Actually move the double buffer to the single buffer and "update" the screen
|
|
|
|
fn draw();
|
|
|
|
fn clear();
|
|
|
|
}
|