From 865fecb71d187c69f5ed2e13650cf28318e07d57 Mon Sep 17 00:00:00 2001 From: Ryan Kennedy Date: Wed, 25 Mar 2020 01:16:21 -0500 Subject: [PATCH] Implemented screen for 640x480x16 --- src/writers/graphics_640x480x16.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/writers/graphics_640x480x16.rs b/src/writers/graphics_640x480x16.rs index e035d6f..f7edd28 100644 --- a/src/writers/graphics_640x480x16.rs +++ b/src/writers/graphics_640x480x16.rs @@ -1,4 +1,4 @@ -use super::GraphicsWriter; +use super::{GraphicsWriter, Screen}; use crate::{ colors::{Color16, DEFAULT_PALETTE}, drawing::{Bresenham, Point}, @@ -10,6 +10,7 @@ use spinning_top::SpinlockGuard; const WIDTH: usize = 640; const HEIGHT: usize = 480; +const SIZE: usize = WIDTH * HEIGHT; const ALL_PLANES_SCREEN_SIZE: usize = (WIDTH * HEIGHT) / 8; const WIDTH_IN_BYTES: usize = WIDTH / 8; @@ -38,6 +39,18 @@ const WIDTH_IN_BYTES: usize = WIDTH / 8; #[derive(Default)] pub struct Graphics640x480x16; +impl Screen for Graphics640x480x16 { + fn get_width(&self) -> usize { + WIDTH + } + fn get_height(&self) -> usize { + HEIGHT + } + fn get_size(&self) -> usize { + SIZE + } +} + impl GraphicsWriter for Graphics640x480x16 { fn clear_screen(&self, color: Color16) { self.set_write_mode_2();