forked from AGL/AGL_Simple_Impl
66 lines
1.5 KiB
Rust
66 lines
1.5 KiB
Rust
#![allow(dead_code, unused)]
|
|
|
|
use able_graphics_library::{AglApi, FrameBuffer, Point, HEIGHT, RGBA, WIDTH};
|
|
|
|
#[derive(Clone, Debug, Copy)]
|
|
pub struct GraphicsRenderer {
|
|
pub buff: FrameBuffer,
|
|
}
|
|
impl GraphicsRenderer {
|
|
pub fn new() -> GraphicsRenderer {
|
|
let rgba = RGBA {
|
|
r: 0,
|
|
g: 0,
|
|
b: 0,
|
|
a: 0,
|
|
};
|
|
|
|
let buffer = [rgba; WIDTH * HEIGHT];
|
|
|
|
Self { buff: buffer }
|
|
}
|
|
}
|
|
|
|
impl AglApi for GraphicsRenderer {
|
|
fn put_line(&mut self, coords_start: Point, coords_end: Point, thickness: u32, color: RGBA) {
|
|
todo!();
|
|
}
|
|
fn put_rect(&mut self, coords_start: Point, coords_end: Point, color: RGBA) {
|
|
todo!();
|
|
}
|
|
fn put_circle(&mut self, coords: Point, radius: u32) {
|
|
todo!();
|
|
}
|
|
fn put_pixel(&mut self, coords: Point, color: RGBA) {
|
|
let coordinates = coords.x + (WIDTH as u16).wrapping_mul(coords.y);
|
|
|
|
self.buff[coordinates as usize] = color;
|
|
}
|
|
fn put_triangle(
|
|
&mut self,
|
|
coords_1: Point,
|
|
coords_2: Point,
|
|
coords_3: Point,
|
|
thickness: u32,
|
|
color: RGBA,
|
|
) {
|
|
todo!();
|
|
}
|
|
fn paint_cursor(&mut self, coords: Point) {
|
|
todo!();
|
|
}
|
|
fn hide_cursor() {
|
|
todo!();
|
|
}
|
|
fn show_cursor() {
|
|
todo!();
|
|
}
|
|
/// Actually move the double buffer to the single buffer and "update" the screen
|
|
fn draw(&mut self) {}
|
|
fn clear(&mut self, color: RGBA) {
|
|
for x in 0..600 * 400 {
|
|
self.buff[x as usize] = color;
|
|
}
|
|
}
|
|
}
|