servicepoint-simulator/src/main.rs

42 lines
869 B
Rust
Raw Normal View History

2024-05-09 00:46:03 +02:00
#![deny(clippy::all)]
2024-05-10 18:24:26 +02:00
mod font;
2024-05-09 13:26:33 +02:00
mod gui;
2024-05-10 18:24:26 +02:00
mod upd_loop;
2024-05-09 13:26:33 +02:00
2024-05-09 00:46:03 +02:00
use std::default::Default;
2024-05-09 13:26:33 +02:00
use crate::gui::App;
2024-05-10 18:24:26 +02:00
use crate::upd_loop::UdpThread;
use clap::Parser;
2024-05-09 13:26:33 +02:00
use log::info;
2024-05-10 18:24:26 +02:00
use servicepoint2::PIXEL_COUNT;
2024-05-09 13:26:33 +02:00
use winit::event_loop::{ControlFlow, EventLoop};
#[derive(Parser, Debug)]
struct Cli {
2024-05-10 12:36:42 +02:00
#[arg(long, default_value = "0.0.0.0:2342")]
bind: String,
}
2024-05-09 00:46:03 +02:00
static mut DISPLAY: [bool; PIXEL_COUNT] = [false; PIXEL_COUNT];
2024-05-08 20:17:39 +02:00
2024-05-09 00:46:03 +02:00
fn main() {
env_logger::init();
let cli = Cli::parse();
info!("starting with args: {:?}", &cli);
2024-05-08 13:21:31 +02:00
2024-05-10 18:24:26 +02:00
let thread = UdpThread::start_new(cli.bind);
2024-05-09 00:46:03 +02:00
let event_loop = EventLoop::new().expect("could not create event loop");
event_loop.set_control_flow(ControlFlow::Poll);
2024-05-08 20:17:39 +02:00
2024-05-09 00:46:03 +02:00
let mut app = App::default();
event_loop
.run_app(&mut app)
.expect("could not run event loop");
2024-05-10 18:24:26 +02:00
thread.stop_and_wait();
2024-05-09 00:46:03 +02:00
}