Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
39
crates/bin/src/main.rs
Normal file
39
crates/bin/src/main.rs
Normal file
@@ -0,0 +1,39 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user