Files
dvd-thing/crates/bin/src/main.rs
Gabriel Kaszewski 15fdace324
All checks were successful
CI / Check / Test (push) Successful in 3m40s
init v.1.0.0
Co-authored-by: Copilot <copilot@github.com>
2026-08-06 20:11:22 +02:00

40 lines
1.1 KiB
Rust

use std::process::ExitCode;
use application::DisplayOverlayPort;
use assets::FileLogoSource;
use domain::{Color, Dimensions, ScreensaverScene, Vector2D};
use wayland::{SoftwareRenderer, WaylandDisplay};
const LOGO: Dimensions = match Dimensions::new(320, 198) {
Some(size) => size,
None => panic!("logo dimensions must be non-zero"),
};
const SPEED: Vector2D = match Vector2D::new(3.0, 2.0) {
Some(speed) => speed,
None => panic!("logo speed must be finite"),
};
const START_COLOR: Color = Color {
r: 255,
g: 0,
b: 0,
a: 255,
};
fn main() -> ExitCode {
match run() {
Ok(()) => ExitCode::SUCCESS,
Err(e) => {
eprintln!("dvd-thing: {e}");
ExitCode::FAILURE
}
}
}
fn run() -> Result<(), application::ApplicationError> {
let mut display = WaylandDisplay::new()?;
let mut renderer = SoftwareRenderer::new(&display, &FileLogoSource::from_env()?)?;
let mut scene = ScreensaverScene::new(LOGO, SPEED, START_COLOR, display.screen_dimensions())?;
application::run(&mut display, &mut renderer, &mut scene)
}