diff --git a/src/main.rs b/src/main.rs index 8ccda34..7e5a04b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -173,6 +173,8 @@ struct App { tx: Sender, rx: Receiver, connected: Option, + startup_time: f64, + fullscreen_set: bool, } impl App { @@ -185,6 +187,8 @@ impl App { tx: tx_cmd, rx: rx_status, connected: None, + startup_time: macroquad::time::get_time(), + fullscreen_set: false, } } @@ -249,6 +253,11 @@ impl App { } async fn update(&mut self) { + if !self.fullscreen_set && macroquad::time::get_time() - self.startup_time >= 1.0 { + set_fullscreen(true); + self.fullscreen_set = true; + } + match self.rx.recv_timeout(Duration::from_millis(100)) { Ok(status) => match status { SerialStatus::SerialDisconnected => self.connected = None, @@ -285,7 +294,6 @@ impl App { #[macroquad::main("singer")] async fn main() { - set_fullscreen(true); let mut app = App::new(); app.run().await; }