split screen logic into seprate crate for testing

This commit is contained in:
2025-06-29 08:44:17 -06:00
parent 06a158623d
commit 073fa58121
15 changed files with 499 additions and 218 deletions

9
simulator/Cargo.toml Normal file
View File

@@ -0,0 +1,9 @@
[package]
name = "simulator"
version = "0.1.0"
edition = "2024"
[dependencies]
embedded-graphics = "0.8.1"
embedded-graphics-simulator = "0.7.0"
shared = { path = "../shared" }

32
simulator/src/main.rs Normal file
View File

@@ -0,0 +1,32 @@
#![feature(ascii_char)]
use embedded_graphics::{
geometry::Size,
mono_font::{
MonoFont, MonoTextStyle,
ascii::{FONT_6X9, FONT_10X20},
},
pixelcolor::{BinaryColor, Rgb565},
prelude::{Point, WebColors, *},
primitives::{Circle, Line, PrimitiveStyle, Rectangle},
text::{Alignment, Baseline, Text, TextStyle},
};
use embedded_graphics_simulator::{
BinaryColorTheme, OutputSettingsBuilder, SimulatorDisplay, Window,
};
use shared::{SCREEN_HEIGHT, SCREEN_WIDTH, TextBuffer};
fn main() -> Result<(), core::convert::Infallible> {
let mut display =
SimulatorDisplay::<Rgb565>::new(Size::new(SCREEN_WIDTH as u32, SCREEN_HEIGHT as u32));
let mut textbuffer = TextBuffer::new();
textbuffer.fill('A');
textbuffer.draw(&mut display);
let output_settings = OutputSettingsBuilder::new().build();
Window::new("Hello World", &output_settings).show_static(&display);
Ok(())
}